Module: Capybara::RSpecMatchers
- Defined in:
- lib/capybara/rspec/compound.rb,
lib/capybara/rspec/matchers.rb
Defined Under Namespace
Modules: Compound Classes: BecomeClosed, HaveAllSelectors, HaveCurrentPath, HaveNoSelectors, HaveSelector, HaveStyle, HaveText, HaveTitle, MatchSelector, Matcher, NegatedMatcher
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 See Node::Matcher#assert_all_of_selectors.
-
#have_button(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for buttons See Node::Matchers#has_button?.
-
#have_checked_field(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for checked fields See Node::Matchers#has_checked_field?.
-
#have_css(css, **options, &optional_filter_block) ⇒ Object
RSpec matcher for whether elements(s) matching a given css selector exist See Node::Matchers#has_css?.
-
#have_current_path(path, **options) ⇒ Object
RSpec matcher for the current path See SessionMatchers#assert_current_path.
-
#have_field(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for links See Node::Matchers#has_field?.
-
#have_link(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for links See Node::Matchers#has_link?.
-
#have_none_of_selectors(*args, &optional_filter_block) ⇒ Object
RSpec matcher for whether no element(s) matching a group of selectors exist See Node::Matcher#assert_none_of_selectors.
-
#have_select(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for select elements See Node::Matchers#has_select?.
-
#have_selector(*args, &optional_filter_block) ⇒ Object
RSpec matcher for whether the element(s) matching a given selector exist See Node::Matcher#assert_selector.
-
#have_style(styles, **options) ⇒ Object
RSpec matcher for element style See Node::Matchers#has_style?.
-
#have_table(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for table elements See Node::Matchers#has_table?.
-
#have_text(*args) ⇒ Object
(also: #have_content)
RSpec matcher for text content See SessionMatchers#assert_text.
- #have_title(title, **options) ⇒ Object
-
#have_unchecked_field(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for unchecked fields See Node::Matchers#has_unchecked_field?.
-
#have_xpath(xpath, **options, &optional_filter_block) ⇒ Object
RSpec matcher for whether elements(s) matching a given xpath selector exist See Node::Matchers#has_xpath?.
-
#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 See Node::Matchers#assert_matches_selector.
-
#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.
401 402 403 |
# File 'lib/capybara/rspec/matchers.rb', line 401 def become_closed(**) 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 See Node::Matcher#assert_all_of_selectors
279 280 281 |
# File 'lib/capybara/rspec/matchers.rb', line 279 def have_all_of_selectors(*args, &optional_filter_block) HaveAllSelectors.new(*args, &optional_filter_block) end |
#have_button(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for buttons See Node::Matchers#has_button?
342 343 344 |
# File 'lib/capybara/rspec/matchers.rb', line 342 def (locator = nil, **, &optional_filter_block) HaveSelector.new(:button, locator, , &optional_filter_block) end |
#have_checked_field(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for checked fields See Node::Matchers#has_checked_field?
354 355 356 |
# File 'lib/capybara/rspec/matchers.rb', line 354 def have_checked_field(locator = nil, **, &optional_filter_block) HaveSelector.new(:field, locator, .merge(checked: true), &optional_filter_block) end |
#have_css(css, **options, &optional_filter_block) ⇒ Object
RSpec matcher for whether elements(s) matching a given css selector exist See Node::Matchers#has_css?
308 309 310 |
# File 'lib/capybara/rspec/matchers.rb', line 308 def have_css(css, **, &optional_filter_block) HaveSelector.new(:css, css, , &optional_filter_block) end |
#have_current_path(path, **options) ⇒ Object
RSpec matcher for the current path See SessionMatchers#assert_current_path
330 331 332 |
# File 'lib/capybara/rspec/matchers.rb', line 330 def have_current_path(path, **) HaveCurrentPath.new(path, ) end |
#have_field(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for links See Node::Matchers#has_field?
348 349 350 |
# File 'lib/capybara/rspec/matchers.rb', line 348 def have_field(locator = nil, **, &optional_filter_block) HaveSelector.new(:field, locator, , &optional_filter_block) end |
#have_link(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for links See Node::Matchers#has_link?
336 337 338 |
# File 'lib/capybara/rspec/matchers.rb', line 336 def have_link(locator = nil, **, &optional_filter_block) HaveSelector.new(:link, locator, , &optional_filter_block) end |
#have_none_of_selectors(*args, &optional_filter_block) ⇒ Object
RSpec matcher for whether no element(s) matching a group of selectors exist See Node::Matcher#assert_none_of_selectors
285 286 287 |
# File 'lib/capybara/rspec/matchers.rb', line 285 def have_none_of_selectors(*args, &optional_filter_block) HaveNoSelectors.new(*args, &optional_filter_block) end |
#have_select(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for select elements See Node::Matchers#has_select?
366 367 368 |
# File 'lib/capybara/rspec/matchers.rb', line 366 def have_select(locator = nil, **, &optional_filter_block) HaveSelector.new(:select, locator, , &optional_filter_block) end |
#have_selector(*args, &optional_filter_block) ⇒ Object
RSpec matcher for whether the element(s) matching a given selector exist See Node::Matcher#assert_selector
273 274 275 |
# File 'lib/capybara/rspec/matchers.rb', line 273 def have_selector(*args, &optional_filter_block) HaveSelector.new(*args, &optional_filter_block) end |
#have_style(styles, **options) ⇒ Object
RSpec matcher for element style See Node::Matchers#has_style?
378 379 380 |
# File 'lib/capybara/rspec/matchers.rb', line 378 def have_style(styles, **) HaveStyle.new(styles, ) end |
#have_table(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for table elements See Node::Matchers#has_table?
372 373 374 |
# File 'lib/capybara/rspec/matchers.rb', line 372 def have_table(locator = nil, **, &optional_filter_block) HaveSelector.new(:table, locator, , &optional_filter_block) end |
#have_text(*args) ⇒ Object Also known as: have_content
RSpec matcher for text content See SessionMatchers#assert_text
319 320 321 |
# File 'lib/capybara/rspec/matchers.rb', line 319 def have_text(*args) HaveText.new(*args) end |
#have_title(title, **options) ⇒ Object
324 325 326 |
# File 'lib/capybara/rspec/matchers.rb', line 324 def have_title(title, **) HaveTitle.new(title, ) end |
#have_unchecked_field(locator = nil, **options, &optional_filter_block) ⇒ Object
RSpec matcher for unchecked fields See Node::Matchers#has_unchecked_field?
360 361 362 |
# File 'lib/capybara/rspec/matchers.rb', line 360 def have_unchecked_field(locator = nil, **, &optional_filter_block) HaveSelector.new(:field, locator, .merge(unchecked: true), &optional_filter_block) end |
#have_xpath(xpath, **options, &optional_filter_block) ⇒ Object
RSpec matcher for whether elements(s) matching a given xpath selector exist See Node::Matchers#has_xpath?
297 298 299 |
# File 'lib/capybara/rspec/matchers.rb', line 297 def have_xpath(xpath, **, &optional_filter_block) HaveSelector.new(:xpath, xpath, , &optional_filter_block) end |
#match_css(css, **options, &optional_filter_block) ⇒ Object
RSpec matcher for whether the current element matches a given css selector
313 314 315 |
# File 'lib/capybara/rspec/matchers.rb', line 313 def match_css(css, **, &optional_filter_block) MatchSelector.new(:css, css, , &optional_filter_block) end |
#match_selector(*args, &optional_filter_block) ⇒ Object
RSpec matcher for whether the current element matches a given selector See Node::Matchers#assert_matches_selector
291 292 293 |
# File 'lib/capybara/rspec/matchers.rb', line 291 def match_selector(*args, &optional_filter_block) MatchSelector.new(*args, &optional_filter_block) end |
#match_xpath(xpath, **options, &optional_filter_block) ⇒ Object
RSpec matcher for whether the current element matches a given xpath selector
302 303 304 |
# File 'lib/capybara/rspec/matchers.rb', line 302 def match_xpath(xpath, **, &optional_filter_block) MatchSelector.new(:xpath, xpath, , &optional_filter_block) end |