Class: ElabsMatchers::Matchers::HaveHeader::HaveHeaderMatcher
- Inherits:
-
Struct
- Object
- Struct
- ElabsMatchers::Matchers::HaveHeader::HaveHeaderMatcher
- Defined in:
- lib/elabs_matchers/matchers/have_header.rb
Instance Attribute Summary collapse
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#text ⇒ Object
Returns the value of attribute text.
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
#page ⇒ Object (readonly)
Returns the value of attribute page.
9 10 11 |
# File 'lib/elabs_matchers/matchers/have_header.rb', line 9 def page @page end |
#text ⇒ Object
Returns the value of attribute text
8 9 10 |
# File 'lib/elabs_matchers/matchers/have_header.rb', line 8 def text @text end |
Instance Method Details
#does_not_match?(page) ⇒ Boolean
16 17 18 19 |
# File 'lib/elabs_matchers/matchers/have_header.rb', line 16 def does_not_match?(page) @page = page page.has_no_selector?(selector_type, selector, :text => text) end |
#failure_message ⇒ Object Also known as: failure_message_for_should
21 22 23 24 |
# File 'lib/elabs_matchers/matchers/have_header.rb', line 21 def headers = page.all(selector_type, selector).map { |h| "'#{h.text}'" }.to_sentence "Expected header to be '#{text}' but it had the headers #{headers}." end |
#failure_message_when_negated ⇒ Object Also known as: failure_message_for_should_not
27 28 29 |
# File 'lib/elabs_matchers/matchers/have_header.rb', line 27 def "Expected header not to be '#{text}' but it was." end |
#matches?(page) ⇒ Boolean
11 12 13 14 |
# File 'lib/elabs_matchers/matchers/have_header.rb', line 11 def matches?(page) @page = page page.has_selector?(selector_type, selector, :text => text) end |