Class: Utensils::CustomMatchers::HaveModel
- Inherits:
-
Object
- Object
- Utensils::CustomMatchers::HaveModel
- Defined in:
- lib/utensils/custom_matchers.rb
Instance Method Summary collapse
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(model) ⇒ HaveModel
constructor
A new instance of HaveModel.
- #matches?(page) ⇒ Boolean
Constructor Details
#initialize(model) ⇒ HaveModel
Returns a new instance of HaveModel.
4 5 6 |
# File 'lib/utensils/custom_matchers.rb', line 4 def initialize(model) @model_id = ApplicationController.helpers.dom_id(model) end |
Instance Method Details
#failure_message ⇒ Object
13 14 15 |
# File 'lib/utensils/custom_matchers.rb', line 13 def "expected #{@page.body} to contain element with id: #{@model_id}" end |
#failure_message_when_negated ⇒ Object
17 18 19 |
# File 'lib/utensils/custom_matchers.rb', line 17 def "expected #{@page.body} to not contain element with id: #{@model_id}" end |
#matches?(page) ⇒ Boolean
8 9 10 11 |
# File 'lib/utensils/custom_matchers.rb', line 8 def matches?(page) @page = page @page.has_css?("##{@model_id}") end |