Reputation: 159
Two newbs are working on our first little ruby/sinatra gizmo, a cat fighting game.
Our caybara test looks like this, but it passes only some times (when content eq 19) - the HP (starting at 20) can be reduced by 1, 2 or 3. How would you solve this?
feature 'reduce hp' do
scenario 'get a confirmation with lower HP' do
sign_in_and_play_and_scratch
expect(page).to have_content (19 or 18 or 17)
end
end
Many thanks from Sweden
Upvotes: 0
Views: 56
Reputation: 49870
have_content takes a string or a regex to match against, so for multiple potential matches a regex is the easiest
expect(page).to have_content(/19|18|17/)
Upvotes: 2