Equality using OR in RSpec 2
Wh开发者_C百科at is the correct way to write the following example? The player's score should equal 5 or 8.
it "should equal 5 or 8" do
player.score.should == 5 or 8
end
Thanks!
Tim
5 or 8
will produce result 5 all the time and not do what you expect. You can use Rspec's satisfy matcher.
player.score.should satisfy {|s| [5,8].include?(s)}
精彩评论