Class: StimulusSpec::Capybara::Matchers::HaveStimulusAction
- Inherits:
-
Object
- Object
- StimulusSpec::Capybara::Matchers::HaveStimulusAction
- Defined in:
- lib/stimulus_spec/capybara/matchers/have_stimulus_action.rb
Instance Method Summary collapse
- #description ⇒ Object
- #does_not_match?(page) ⇒ Boolean
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(descriptor) ⇒ HaveStimulusAction
constructor
A new instance of HaveStimulusAction.
- #matches?(page) ⇒ Boolean
Constructor Details
#initialize(descriptor) ⇒ HaveStimulusAction
Returns a new instance of HaveStimulusAction.
7 8 9 |
# File 'lib/stimulus_spec/capybara/matchers/have_stimulus_action.rb', line 7 def initialize(descriptor) @descriptor = descriptor.to_s end |
Instance Method Details
#description ⇒ Object
28 29 30 |
# File 'lib/stimulus_spec/capybara/matchers/have_stimulus_action.rb', line 28 def description "have Stimulus action \"#{@descriptor}\"" end |
#does_not_match?(page) ⇒ Boolean
16 17 18 |
# File 'lib/stimulus_spec/capybara/matchers/have_stimulus_action.rb', line 16 def does_not_match?(page) page.has_no_css?(css_selector, wait: 0) end |
#failure_message ⇒ Object
20 21 22 |
# File 'lib/stimulus_spec/capybara/matchers/have_stimulus_action.rb', line 20 def "expected to find an element with data-action=\"#{@descriptor}\" on the page" end |
#failure_message_when_negated ⇒ Object
24 25 26 |
# File 'lib/stimulus_spec/capybara/matchers/have_stimulus_action.rb', line 24 def "expected not to find an element with data-action=\"#{@descriptor}\" on the page" end |
#matches?(page) ⇒ Boolean
11 12 13 14 |
# File 'lib/stimulus_spec/capybara/matchers/have_stimulus_action.rb', line 11 def matches?(page) @page = page page.has_css?(css_selector, wait: 0) end |