Rspec: Should be (this or that)

后端 未结 6 1176
無奈伤痛
無奈伤痛 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:19

    I know this is old but in I ran into this on RSpec 3.4, there is an or keyword now. So this is valid:

    expect(flip_coin).to eq('heads').or(eq('tails'))
    

提交回复
热议问题