Module: Dommy::RSpec::CapyStyleMatchers
- Defined in:
- lib/dommy/rspec/capy_style_matchers.rb
Overview
Capybara-style RSpec matchers backed by Dommy.
These mirror Capybara’s matcher names (‘have_selector`, `have_content`, `have_link`, etc.) so existing Capybara test suites can be migrated to a pure-Ruby DOM stack with minimal code changes.
Because the names collide with Capybara::RSpecMatchers, this module should be included into specs that DO NOT also include Capybara —typically view / component / request specs, with feature specs left to Capybara. See the README for a ‘type:` split example.
Defined Under Namespace
Modules: Negated
Classes: Base, HaveButton, HaveContent, HaveField, HaveLink, HaveNoButton, HaveNoContent, HaveNoField, HaveNoLink, HaveNoSelector, HaveSelector
Instance Method Summary
collapse
-
#have_button(text = nil, **opts) ⇒ Object
-
#have_content(text, **opts) ⇒ Object
(also: #have_text)
-
#have_field(name_or_label = nil, **opts) ⇒ Object
-
#have_link(text = nil, **opts) ⇒ Object
-
#have_no_button(text = nil, **opts) ⇒ Object
-
#have_no_content(text, **opts) ⇒ Object
(also: #have_no_text)
-
#have_no_field(name_or_label = nil, **opts) ⇒ Object
-
#have_no_link(text = nil, **opts) ⇒ Object
-
#have_no_selector(selector, **opts) ⇒ Object
(also: #have_no_css)
-
#have_selector(selector, **opts) ⇒ Object
(also: #have_css)
Instance Method Details
63
64
65
|
# File 'lib/dommy/rspec/capy_style_matchers.rb', line 63
def have_button(text = nil, **opts)
HaveButton.new(text, **opts)
end
|
#have_content(text, **opts) ⇒ Object
Also known as:
have_text
43
44
45
|
# File 'lib/dommy/rspec/capy_style_matchers.rb', line 43
def have_content(text, **opts)
HaveContent.new(text, **opts)
end
|
#have_field(name_or_label = nil, **opts) ⇒ Object
71
72
73
|
# File 'lib/dommy/rspec/capy_style_matchers.rb', line 71
def have_field(name_or_label = nil, **opts)
HaveField.new(name_or_label, **opts)
end
|
#have_link(text = nil, **opts) ⇒ Object
55
56
57
|
# File 'lib/dommy/rspec/capy_style_matchers.rb', line 55
def have_link(text = nil, **opts)
HaveLink.new(text, **opts)
end
|
67
68
69
|
# File 'lib/dommy/rspec/capy_style_matchers.rb', line 67
def have_no_button(text = nil, **opts)
HaveNoButton.new(text, **opts)
end
|
#have_no_content(text, **opts) ⇒ Object
Also known as:
have_no_text
49
50
51
|
# File 'lib/dommy/rspec/capy_style_matchers.rb', line 49
def have_no_content(text, **opts)
HaveNoContent.new(text, **opts)
end
|
#have_no_field(name_or_label = nil, **opts) ⇒ Object
75
76
77
|
# File 'lib/dommy/rspec/capy_style_matchers.rb', line 75
def have_no_field(name_or_label = nil, **opts)
HaveNoField.new(name_or_label, **opts)
end
|
#have_no_link(text = nil, **opts) ⇒ Object
59
60
61
|
# File 'lib/dommy/rspec/capy_style_matchers.rb', line 59
def have_no_link(text = nil, **opts)
HaveNoLink.new(text, **opts)
end
|
#have_no_selector(selector, **opts) ⇒ Object
Also known as:
have_no_css
37
38
39
|
# File 'lib/dommy/rspec/capy_style_matchers.rb', line 37
def have_no_selector(selector, **opts)
HaveNoSelector.new(selector, **opts)
end
|
#have_selector(selector, **opts) ⇒ Object
Also known as:
have_css
31
32
33
|
# File 'lib/dommy/rspec/capy_style_matchers.rb', line 31
def have_selector(selector, **opts)
HaveSelector.new(selector, **opts)
end
|