Class: Dommy::Rails::RSpec::Matchers::HaveStimulusController
- Inherits:
-
Object
- Object
- Dommy::Rails::RSpec::Matchers::HaveStimulusController
- 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(name) ⇒ HaveStimulusController
constructor
A new instance of HaveStimulusController.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(name) ⇒ HaveStimulusController
Returns a new instance of HaveStimulusController.
477 478 479 |
# File 'lib/dommy/rails/rspec/matchers.rb', line 477 def initialize(name) @name = name end |
Instance Method Details
#description ⇒ Object
489 490 491 |
# File 'lib/dommy/rails/rspec/matchers.rb', line 489 def description "have Stimulus controller #{@name.inspect}" end |
#does_not_match?(actual) ⇒ Boolean
485 486 487 |
# File 'lib/dommy/rails/rspec/matchers.rb', line 485 def does_not_match?(actual) !matches?(actual) end |
#failure_message ⇒ Object
493 494 495 |
# File 'lib/dommy/rails/rspec/matchers.rb', line 493 def "expected to find element with Stimulus controller #{@name.inspect}" end |
#failure_message_when_negated ⇒ Object
497 498 499 |
# File 'lib/dommy/rails/rspec/matchers.rb', line 497 def "expected not to find element with Stimulus controller #{@name.inspect}" end |
#matches?(actual) ⇒ Boolean
481 482 483 |
# File 'lib/dommy/rails/rspec/matchers.rb', line 481 def matches?(actual) Dommy::Rails::Stimulus.controller?(MatchTarget.document(actual), @name) end |