Class: Capybara::RSpecMatchers::HaveSelector
- Defined in:
- lib/capybara/rspec/matchers.rb
Instance Attribute Summary collapse
-
#failure_message ⇒ Object
(also: #failure_message_for_should)
readonly
Returns the value of attribute failure_message.
-
#failure_message_when_negated ⇒ Object
(also: #failure_message_for_should_not)
readonly
Returns the value of attribute failure_message_when_negated.
Instance Method Summary collapse
- #description ⇒ Object
- #does_not_match?(actual) ⇒ Boolean
-
#initialize(*args) ⇒ HaveSelector
constructor
A new instance of HaveSelector.
- #matches?(actual) ⇒ Boolean
- #query ⇒ Object
Methods inherited from Matcher
Constructor Details
#initialize(*args) ⇒ HaveSelector
Returns a new instance of HaveSelector.
18 19 20 |
# File 'lib/capybara/rspec/matchers.rb', line 18 def initialize(*args) @args = args end |
Instance Attribute Details
#failure_message ⇒ Object (readonly) Also known as: failure_message_for_should
Returns the value of attribute failure_message.
16 17 18 |
# File 'lib/capybara/rspec/matchers.rb', line 16 def @failure_message end |
#failure_message_when_negated ⇒ Object (readonly) Also known as: failure_message_for_should_not
Returns the value of attribute failure_message_when_negated.
16 17 18 |
# File 'lib/capybara/rspec/matchers.rb', line 16 def @failure_message_when_negated end |
Instance Method Details
#description ⇒ Object
36 37 38 |
# File 'lib/capybara/rspec/matchers.rb', line 36 def description "have #{query.description}" end |
#does_not_match?(actual) ⇒ Boolean
29 30 31 32 33 34 |
# File 'lib/capybara/rspec/matchers.rb', line 29 def does_not_match?(actual) wrap(actual).assert_no_selector(*@args) rescue Capybara::ExpectationNotMet => e @failure_message_when_negated = e. return false end |
#matches?(actual) ⇒ Boolean
22 23 24 25 26 27 |
# File 'lib/capybara/rspec/matchers.rb', line 22 def matches?(actual) wrap(actual).assert_selector(*@args) rescue Capybara::ExpectationNotMet => e @failure_message = e. return false end |