Module: Capybara::Compose::ToOrExpectationHandler
- Defined in:
- lib/capybara/compose/to_or_expectation_handler.rb
Overview
Internal: Used heavily in the RSpec matchers, makes it very easy to create a dual assertion (can be used as positive or negative).
Instance Method Summary collapse
-
#to_or(not_to, matcher, message = nil, &block) ⇒ Object
Public: Allows a more convenient definition of should/should not Gherkin steps.
Instance Method Details
#to_or(not_to, matcher, message = nil, &block) ⇒ Object
Public: Allows a more convenient definition of should/should not Gherkin steps.
Example:
Then(/^I should (not )?see "(.*)"$/) do |not_to, text|
expect(page).to_or not_to, have_content(text)
end
16 17 18 19 20 21 22 |
# File 'lib/capybara/compose/to_or_expectation_handler.rb', line 16 def to_or(not_to, matcher, = nil, &block) if not_to not_to(matcher, , &block) else to(matcher, , &block) end end |