Module: Capybara::RSpecMatchers
- Defined in:
- lib/capybara/rspec/matchers.rb,
lib/capybara/rspec/matchers/base.rb,
lib/capybara/rspec/matchers/compound.rb,
lib/capybara/rspec/matchers/have_text.rb,
lib/capybara/rspec/matchers/have_title.rb,
lib/capybara/rspec/matchers/count_sugar.rb,
lib/capybara/rspec/matchers/match_style.rb,
lib/capybara/rspec/matchers/match_style.rb,
lib/capybara/rspec/matchers/have_sibling.rb,
lib/capybara/rspec/matchers/become_closed.rb,
lib/capybara/rspec/matchers/have_ancestor.rb,
lib/capybara/rspec/matchers/have_selector.rb,
lib/capybara/rspec/matchers/match_selector.rb,
lib/capybara/rspec/matchers/have_current_path.rb
Defined Under Namespace
Modules: CountSugar, Matchers
Instance Method Summary collapse
-
#become_closed(**options) ⇒ Object
Wait for window to become closed.
-
#have_all_of_selectors(*args, &optional_filter_block) ⇒ Object
RSpec matcher for whether the element(s) matching a group of selectors exist.
-
#have_ancestor(*args, &optional_filter_block) ⇒ Object
RSpec matcher for whether ancestor element(s) matching a given selector exist.
-
#have_any_of_selectors(*args, &optional_filter_block) ⇒ Object
RSpec matcher for whether the element(s) matching any of a group of selectors exist.
-
#have_button(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for buttons.
-
#have_checked_field(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for checked fields.
-
#have_css(css, **options, &optional_filter_block) ⇒ Object
RSpec matcher for whether elements(s) matching a given css selector exist.
-
#have_current_path(path, **options) ⇒ Object
RSpec matcher for the current path.
-
#have_field(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for links.
-
#have_link(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for links.
-
#have_none_of_selectors(*args, &optional_filter_block) ⇒ Object
RSpec matcher for whether no element(s) matching a group of selectors exist.
-
#have_select(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for select elements.
-
#have_selector(*args, &optional_filter_block) ⇒ Object
RSpec matcher for whether the element(s) matching a given selector exist.
-
#have_sibling(*args, &optional_filter_block) ⇒ Object
RSpec matcher for whether sibling element(s) matching a given selector exist.
- #have_style(styles, **options) ⇒ Object deprecated Deprecated.
-
#have_table(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for table elements.
-
#have_text(*args) ⇒ Object
(also: #have_content)
RSpec matcher for text content.
- #have_title(title, **options) ⇒ Object
-
#have_unchecked_field(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for unchecked fields.
-
#have_xpath(xpath, **options, &optional_filter_block) ⇒ Object
RSpec matcher for whether elements(s) matching a given xpath selector exist.
-
#match_css(css, **options, &optional_filter_block) ⇒ Object
RSpec matcher for whether the current element matches a given css selector.
-
#match_selector(*args, &optional_filter_block) ⇒ Object
RSpec matcher for whether the current element matches a given selector.
-
#match_style(styles, **options) ⇒ Object
RSpec matcher for element style.
-
#match_xpath(xpath, **options, &optional_filter_block) ⇒ Object
RSpec matcher for whether the current element matches a given xpath selector.
Instance Method Details
#become_closed(**options) ⇒ Object
Wait for window to become closed.
197 198 199 |
# File 'lib/capybara/rspec/matchers.rb', line 197 def become_closed(**) Matchers::BecomeClosed.new() end |
#have_all_of_selectors(*args, &optional_filter_block) ⇒ Object
RSpec matcher for whether the element(s) matching a group of selectors exist.
25 26 27 |
# File 'lib/capybara/rspec/matchers.rb', line 25 def have_all_of_selectors(*args, &optional_filter_block) Matchers::HaveAllSelectors.new(*args, &optional_filter_block) end |
#have_ancestor(*args, &optional_filter_block) ⇒ Object
RSpec matcher for whether ancestor element(s) matching a given selector exist.
186 187 188 |
# File 'lib/capybara/rspec/matchers.rb', line 186 def have_ancestor(*args, &optional_filter_block) Matchers::HaveAncestor.new(*args, &optional_filter_block) end |
#have_any_of_selectors(*args, &optional_filter_block) ⇒ Object
RSpec matcher for whether the element(s) matching any of a group of selectors exist.
39 40 41 |
# File 'lib/capybara/rspec/matchers.rb', line 39 def have_any_of_selectors(*args, &optional_filter_block) Matchers::HaveAnySelectors.new(*args, &optional_filter_block) end |
#have_button(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for buttons.
|
# File 'lib/capybara/rspec/matchers.rb', line 91
|
#have_checked_field(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for checked fields.
|
# File 'lib/capybara/rspec/matchers.rb', line 117
|
#have_css(css, **options, &optional_filter_block) ⇒ Object
RSpec matcher for whether elements(s) matching a given css selector exist
|
# File 'lib/capybara/rspec/matchers.rb', line 65
|
#have_current_path(path, **options) ⇒ Object
RSpec matcher for the current path.
142 143 144 |
# File 'lib/capybara/rspec/matchers.rb', line 142 def have_current_path(path, **) Matchers::HaveCurrentPath.new(path, ) end |
#have_field(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for links.
|
# File 'lib/capybara/rspec/matchers.rb', line 96
|
#have_link(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for links.
|
# File 'lib/capybara/rspec/matchers.rb', line 86
|
#have_none_of_selectors(*args, &optional_filter_block) ⇒ Object
RSpec matcher for whether no element(s) matching a group of selectors exist.
32 33 34 |
# File 'lib/capybara/rspec/matchers.rb', line 32 def have_none_of_selectors(*args, &optional_filter_block) Matchers::HaveNoSelectors.new(*args, &optional_filter_block) end |
#have_select(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for select elements.
|
# File 'lib/capybara/rspec/matchers.rb', line 101
|
#have_selector(*args, &optional_filter_block) ⇒ Object
RSpec matcher for whether the element(s) matching a given selector exist.
18 19 20 |
# File 'lib/capybara/rspec/matchers.rb', line 18 def have_selector(*args, &optional_filter_block) Matchers::HaveSelector.new(*args, &optional_filter_block) end |
#have_sibling(*args, &optional_filter_block) ⇒ Object
RSpec matcher for whether sibling element(s) matching a given selector exist.
179 180 181 |
# File 'lib/capybara/rspec/matchers.rb', line 179 def have_sibling(*args, &optional_filter_block) Matchers::HaveSibling.new(*args, &optional_filter_block) end |
#have_style(styles, **options) ⇒ Object
156 157 158 159 |
# File 'lib/capybara/rspec/matchers.rb', line 156 def have_style(styles, **) warn 'DEPRECATED: have_style is deprecated, please use match_style' match_style(styles, **) end |
#have_table(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for table elements.
111 112 113 114 115 |
# File 'lib/capybara/rspec/matchers.rb', line 111 %i[checked unchecked].each do |state| define_method "have_#{state}_field" do |locator = nil, **, &optional_filter_block| Matchers::HaveSelector.new(:field, locator, .merge(state => true), &optional_filter_block) end end |
#have_text(*args) ⇒ Object Also known as: have_content
RSpec matcher for text content.
130 131 132 |
# File 'lib/capybara/rspec/matchers.rb', line 130 def have_text(*args) Matchers::HaveText.new(*args) end |
#have_title(title, **options) ⇒ Object
135 136 137 |
# File 'lib/capybara/rspec/matchers.rb', line 135 def have_title(title, **) Matchers::HaveTitle.new(title, ) end |
#have_unchecked_field(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for unchecked fields.
|
# File 'lib/capybara/rspec/matchers.rb', line 122
|
#have_xpath(xpath, **options, &optional_filter_block) ⇒ Object
RSpec matcher for whether elements(s) matching a given xpath selector exist.
|
# File 'lib/capybara/rspec/matchers.rb', line 60
|
#match_css(css, **options, &optional_filter_block) ⇒ Object
RSpec matcher for whether the current element matches a given css selector.
80 81 82 83 84 |
# File 'lib/capybara/rspec/matchers.rb', line 80 %i[link button field select table].each do |selector| define_method "have_#{selector}" do |locator = nil, **, &optional_filter_block| Matchers::HaveSelector.new(selector, locator, , &optional_filter_block) end end |
#match_selector(*args, &optional_filter_block) ⇒ Object
RSpec matcher for whether the current element matches a given selector.
46 47 48 |
# File 'lib/capybara/rspec/matchers.rb', line 46 def match_selector(*args, &optional_filter_block) Matchers::MatchSelector.new(*args, &optional_filter_block) end |
#match_style(styles, **options) ⇒ Object
RSpec matcher for element style.
149 150 151 |
# File 'lib/capybara/rspec/matchers.rb', line 149 def match_style(styles, **) Matchers::MatchStyle.new(styles, ) end |
#match_xpath(xpath, **options, &optional_filter_block) ⇒ Object
RSpec matcher for whether the current element matches a given xpath selector.
|
# File 'lib/capybara/rspec/matchers.rb', line 70
|