Module: CapybaraTestHelpers::ToOrExpectationHandler
- Defined in:
- lib/capybara_test_helpers/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
18 19 20 21 22 23 24 |
# File 'lib/capybara_test_helpers/to_or_expectation_handler.rb', line 18 def to_or(not_to, matcher, = nil, &block) if not_to not_to(matcher, , &block) else to(matcher, , &block) end end |