Class: ElabsMatchers::Matchers::HaveAttribute::HaveAttributeMatcher
- Inherits:
-
Struct
- Object
- Struct
- ElabsMatchers::Matchers::HaveAttribute::HaveAttributeMatcher
- Defined in:
- lib/elabs_matchers/matchers/have_attribute.rb
Instance Attribute Summary collapse
-
#label ⇒ Object
Returns the value of attribute label.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #does_not_match?(page) ⇒ Boolean
- #failure_message ⇒ Object (also: #failure_message_for_should)
- #failure_message_when_negated ⇒ Object (also: #failure_message_for_should_not)
- #matches?(page) ⇒ Boolean
Instance Attribute Details
#label ⇒ Object
Returns the value of attribute label
8 9 10 |
# File 'lib/elabs_matchers/matchers/have_attribute.rb', line 8 def label @label end |
#page ⇒ Object (readonly)
Returns the value of attribute page
9 10 11 |
# File 'lib/elabs_matchers/matchers/have_attribute.rb', line 9 def page @page end |
#value ⇒ Object
Returns the value of attribute value
8 9 10 |
# File 'lib/elabs_matchers/matchers/have_attribute.rb', line 8 def value @value end |
Instance Method Details
#does_not_match?(page) ⇒ Boolean
16 17 18 19 |
# File 'lib/elabs_matchers/matchers/have_attribute.rb', line 16 def does_not_match?(page) @page = page page.has_no_selector?(selector_type, selector) end |
#failure_message ⇒ Object Also known as: failure_message_for_should
21 22 23 24 |
# File 'lib/elabs_matchers/matchers/have_attribute.rb', line 21 def attributes = page.all(:css, "li.wrapper").map(&:text).to_sentence "expected there to be an attribute #{label}: #{value}, but the only attributes were: #{attributes}." end |
#failure_message_when_negated ⇒ Object Also known as: failure_message_for_should_not
27 28 29 |
# File 'lib/elabs_matchers/matchers/have_attribute.rb', line 27 def "expected there to be no attribute #{label}: #{value}, but there was." end |
#matches?(page) ⇒ Boolean
11 12 13 14 |
# File 'lib/elabs_matchers/matchers/have_attribute.rb', line 11 def matches?(page) @page = page page.has_selector?(selector_type, selector) end |