Method: RSpec::Matchers::Composable#or

Defined in:
lib/rspec/matchers/composable.rb

#or(matcher) ⇒ Object Also known as: |

Note:

The negative form (expect(...).not_to matcher.or other) is not supported at this time.

Creates a compound or expectation. The matcher will pass if either sub-matcher passes. This can be chained together to form an arbitrarily long chain of matchers.

Examples:

expect(stoplight.color).to eq("red").or eq("green").or eq("yellow")
expect(stoplight.color).to eq("red") | eq("green") | eq("yellow")


38
39
40
# File 'lib/rspec/matchers/composable.rb', line 38

def or(matcher)
  BuiltIn::Compound::Or.new self, matcher
end