Rspec: Should be (this or that)

后端 未结 6 1179
無奈伤痛
無奈伤痛 2020-12-16 09:38

What would be the best way to write the rspec in a situation where either of two (or more) outcomes are acceptable?

Here\'s an example of what I want to do. This is

6条回答
  •  一整个雨季
    2020-12-16 10:23

    Another way of writing it with the expectation on the right of the should:

    it 'should be heads or tails' do
      flip_coin.should satisfy{|s| ['heads', 'tails'].include?(s)}
    end
    

提交回复
热议问题