Class: Dommy::Rails::RSpec::Matchers::HaveForm
- Inherits:
-
Object
- Object
- Dommy::Rails::RSpec::Matchers::HaveForm
- Defined in:
- lib/dommy/rails/rspec/matchers.rb
Instance Method Summary collapse
- #description ⇒ Object
- #does_not_match?(actual) ⇒ Boolean
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(action:, method:, model:) ⇒ HaveForm
constructor
A new instance of HaveForm.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(action:, method:, model:) ⇒ HaveForm
Returns a new instance of HaveForm.
124 125 126 127 128 |
# File 'lib/dommy/rails/rspec/matchers.rb', line 124 def initialize(action:, method:, model:) @action = action @method = method @model = model end |
Instance Method Details
#description ⇒ Object
139 140 141 |
# File 'lib/dommy/rails/rspec/matchers.rb', line 139 def description "have form #{criteria_description}" end |
#does_not_match?(actual) ⇒ Boolean
135 136 137 |
# File 'lib/dommy/rails/rspec/matchers.rb', line 135 def does_not_match?(actual) !matches?(actual) end |
#failure_message ⇒ Object
143 144 145 |
# File 'lib/dommy/rails/rspec/matchers.rb', line 143 def "expected to find form #{criteria_description}" end |
#failure_message_when_negated ⇒ Object
147 148 149 |
# File 'lib/dommy/rails/rspec/matchers.rb', line 147 def "expected not to find form #{criteria_description}" end |
#matches?(actual) ⇒ Boolean
130 131 132 133 |
# File 'lib/dommy/rails/rspec/matchers.rb', line 130 def matches?(actual) @document = MatchTarget.document(actual) Dommy::Rails::FormInspector.matches?(@document, action: @action, method: @method, model: @model) end |