在RSpec 2中使用OR的平等

编写以下示例的正确方法是什么? 球员的得分应该等于5或8。

it "should equal 5 or 8" do player.score.should == 5 or 8 end 

谢谢!

蒂姆

5 or 8将始终产生结果5而不是你所期望的。 您可以使用Rspec的满足匹配器。

  player.score.should satisfy {|s| [5,8].include?(s)}