Rspec: using OR in expect .to eq statement
You can or
two matchers together:
expect(@note.value).to eq(2).or eq(-2)
For more info see.
As mentioned in another question, you could do it the other way round and have the possible values in the expect
clause. With the new matcher syntax this would look like this:
expect([2, -2]).to include(@note.value)
I should also mention that you'll usually want to avoid this kind of randomness in your tests. Be precise about your expectations!