Class: StimulusSpec::Capybara::Matchers::HaveStimulusAction
- Inherits:
-
Object
- Object
- StimulusSpec::Capybara::Matchers::HaveStimulusAction
- Defined in:
- lib/stimulus_spec/capybara/matchers/have_stimulus_action.rb
Overview
Capybara matcher for +data-action+ attributes.
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
- #within(selector) ⇒ self
Constructor Details
#initialize(descriptor) ⇒ HaveStimulusAction
Returns a new instance of HaveStimulusAction.
12 13 14 |
# File 'lib/stimulus_spec/capybara/matchers/have_stimulus_action.rb', line 12 def initialize(descriptor) @descriptor = descriptor.to_s end |
Instance Method Details
#description ⇒ Object
42 43 44 |
# File 'lib/stimulus_spec/capybara/matchers/have_stimulus_action.rb', line 42 def description "have Stimulus action \"#{@descriptor}\"" end |
#does_not_match?(page) ⇒ Boolean
30 31 32 |
# File 'lib/stimulus_spec/capybara/matchers/have_stimulus_action.rb', line 30 def does_not_match?(page) page.has_no_css?(scoped_selector, wait: 0) end |
#failure_message ⇒ Object
34 35 36 |
# File 'lib/stimulus_spec/capybara/matchers/have_stimulus_action.rb', line 34 def "expected to find an element with data-action=\"#{@descriptor}\" on the page" end |
#failure_message_when_negated ⇒ Object
38 39 40 |
# File 'lib/stimulus_spec/capybara/matchers/have_stimulus_action.rb', line 38 def "expected not to find an element with data-action=\"#{@descriptor}\" on the page" end |
#matches?(page) ⇒ Boolean
25 26 27 28 |
# File 'lib/stimulus_spec/capybara/matchers/have_stimulus_action.rb', line 25 def matches?(page) @page = page page.has_css?(scoped_selector, wait: 0) end |
#within(selector) ⇒ self
18 19 20 21 |
# File 'lib/stimulus_spec/capybara/matchers/have_stimulus_action.rb', line 18 def within(selector) @scope = selector self end |