title: While loops in rspec
body: <p>I'm trying to understand what the best way to test a while loop in rspec would be. </p>
  
  <p>I allow the user to enter the type of game he/she would like to play. </p>
  
  <pre><code>def get_action
      gets.strip.downcase
  end
  
  def type_of_game
      puts "Enter the type of game you would like to play (human v. human, computer v. computer, or human v. computer):"
      gametype = get_action
      until (gametype == "human v. human" || gametype == "computer v. computer" || gametype == "human v. computer")
          puts "Please enter a valid game"
          gametype = get_action
      end
      return gametype
  end
  </code></pre>
  
  <p>Currently I have this in rspec, but it results in an infinite loop</p>
  
  <pre><code>require "minitest/spec"  
  require "minitest/autorun"
  
  
  describe Game do 
     before :each do
      @game = Game.new    
     end
  
  
     it "should prompt to user to enter their gametype again if not human v. human, computer v. computer, or human v. compouter" do
        def @game.get_action; "human v. machine" end
        expect(@game.type_of_game).to eql("Please enter a valid game")
     end
  </code></pre>
  
  <p>Thanks for your help</p>