Class: ElabsMatchers::Matchers::HaveFormErrorsOn::HaveFormErrorsOnMatcher
- Inherits:
-
Struct
- Object
- Struct
- ElabsMatchers::Matchers::HaveFormErrorsOn::HaveFormErrorsOnMatcher
- Defined in:
- lib/elabs_matchers/matchers/have_form_errors_on.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
Returns the value of attribute field.
-
#message ⇒ Object
Returns the value of attribute message.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
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
#field ⇒ Object
Returns the value of attribute field
8 9 10 |
# File 'lib/elabs_matchers/matchers/have_form_errors_on.rb', line 8 def field @field end |
#message ⇒ Object
Returns the value of attribute message
8 9 10 |
# File 'lib/elabs_matchers/matchers/have_form_errors_on.rb', line 8 def @message end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
9 10 11 |
# File 'lib/elabs_matchers/matchers/have_form_errors_on.rb', line 9 def page @page end |
Instance Method Details
#does_not_match?(page) ⇒ Boolean
19 20 21 22 |
# File 'lib/elabs_matchers/matchers/have_form_errors_on.rb', line 19 def does_not_match?(page) @page = page page.has_no_field?(field) || page.find_field(field).has_no_selector?(selector_type, selector, :text => ) end |
#failure_message ⇒ Object Also known as: failure_message_for_should
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/elabs_matchers/matchers/have_form_errors_on.rb', line 24 def if page.has_field?(field) error = page.find_field(field).all(selector_type, selector).first if not error "Expected field '#{field}' to have an error, but it didn't." elsif error.text != "Expected error message on #{field} to be '#{}' but was '#{error.text}'." end else "No such field #{field}." end end |
#failure_message_when_negated ⇒ Object Also known as: failure_message_for_should_not
38 39 40 |
# File 'lib/elabs_matchers/matchers/have_form_errors_on.rb', line 38 def "Expected error message on '#{field}' not to be '#{}' but it was." end |
#matches?(page) ⇒ Boolean
11 12 13 14 15 16 17 |
# File 'lib/elabs_matchers/matchers/have_form_errors_on.rb', line 11 def matches?(page) @page = page if page.has_field?(field) page.find_field(field).has_selector?(selector_type, selector, :text => ) end end |