Module: Capybara::RSpecMatchers
Instance Method Summary
-
#become_closed(**options)
Wait for window to become closed.
-
#have_all_of_selectors
RSpec matcher for whether the element(s) matching a group of selectors exist.
-
#have_ancestor
RSpec matcher for whether ancestor element(s) matching a given selector exist.
-
#have_any_of_selectors
RSpec matcher for whether the element(s) matching any of a group of selectors exist.
-
#have_button(locator = nil, **options, &optional_filter_block)
RSpec matcher for buttons.
-
#have_checked_field(locator = nil, **options, &optional_filter_block)
RSpec matcher for checked fields.
-
#have_content(text_or_type, *args, **options)
Alias for #have_text.
-
#have_css(css, **options, &optional_filter_block)
RSpec matcher for whether elements(s) matching a given css selector exist.
-
#have_current_path(path, **options, &optional_filter_block)
RSpec matcher for the current path.
-
#have_element(locator = nil, **options, &optional_filter_block)
RSpec matcher for elements.
-
#have_field(locator = nil, **options, &optional_filter_block)
RSpec matcher for form fields.
-
#have_link(locator = nil, **options, &optional_filter_block)
RSpec matcher for links.
- #have_no_content
-
#have_none_of_selectors
RSpec matcher for whether no element(s) matching a group of selectors exist.
-
#have_select(locator = nil, **options, &optional_filter_block)
RSpec matcher for select elements.
-
#have_selector
RSpec matcher for whether the element(s) matching a given selector exist.
-
#have_sibling
RSpec matcher for whether sibling element(s) matching a given selector exist.
- #have_style(styles = nil, **options) deprecated Deprecated.
-
#have_table(locator = nil, **options, &optional_filter_block)
RSpec matcher for table elements.
-
#have_text(text_or_type, *args, **options)
(also: #have_content)
RSpec matcher for text content.
- #have_title(title, **options)
-
#have_unchecked_field(locator = nil, **options, &optional_filter_block)
RSpec matcher for unchecked fields.
-
#have_xpath(xpath, **options, &optional_filter_block)
RSpec matcher for whether elements(s) matching a given xpath selector exist.
-
#match_css(css, **options, &optional_filter_block)
RSpec matcher for whether the current element matches a given css selector.
-
#match_selector
RSpec matcher for whether the current element matches a given selector.
-
#match_style(styles = nil, **options)
RSpec matcher for element style.
-
#match_xpath(xpath, **options, &optional_filter_block)
RSpec matcher for whether the current element matches a given xpath selector.
Instance Method Details
#become_closed(**options)
Wait for window to become closed.
# File 'lib/capybara/rspec/matchers.rb', line 203
def become_closed(** ) Matchers::BecomeClosed.new( ) end
#have_all_of_selectors
RSpec matcher for whether the element(s) matching a group of selectors exist.
# File 'lib/capybara/rspec/matchers.rb', line 25
def have_all_of_selectors(...) Matchers::HaveAllSelectors.new(...) end
#have_ancestor
RSpec matcher for whether ancestor element(s) matching a given selector exist.
# File 'lib/capybara/rspec/matchers.rb', line 192
def have_ancestor(...) Matchers::HaveAncestor.new(...) end
#have_any_of_selectors
RSpec matcher for whether the element(s) matching any of a group of selectors exist.
# File 'lib/capybara/rspec/matchers.rb', line 39
def have_any_of_selectors(...) Matchers::HaveAnySelectors.new(...) end
#have_button(locator = nil, **options, &optional_filter_block)
RSpec matcher for buttons.
#have_checked_field(locator = nil, **options, &optional_filter_block)
RSpec matcher for checked fields.
#have_content(text_or_type, *args, **options)
Alias for #have_text.
# File 'lib/capybara/rspec/matchers.rb', line 138
alias_method :have_content, :have_text
#have_css(css, **options, &optional_filter_block)
RSpec matcher for whether elements(s) matching a given css selector exist
#have_current_path(path, **options, &optional_filter_block)
RSpec matcher for the current path.
# File 'lib/capybara/rspec/matchers.rb', line 147
def have_current_path(path, **, &optional_filter_block) Matchers::HaveCurrentPath.new(path, **, &optional_filter_block) end
#have_element(locator = nil, **options, &optional_filter_block)
RSpec matcher for elements.
#have_field(locator = nil, **options, &optional_filter_block)
RSpec matcher for form fields.
#have_link(locator = nil, **options, &optional_filter_block)
RSpec matcher for links.
#have_no_content
[ GitHub ]# File 'lib/capybara/rspec/matchers.rb', line 174
alias_method :have_no_content, :have_no_text
#have_none_of_selectors
RSpec matcher for whether no element(s) matching a group of selectors exist.
# File 'lib/capybara/rspec/matchers.rb', line 32
def have_none_of_selectors(...) Matchers::HaveNoSelectors.new(...) end
#have_select(locator = nil, **options, &optional_filter_block)
RSpec matcher for select elements.
#have_selector
RSpec matcher for whether the element(s) matching a given selector exist.
# File 'lib/capybara/rspec/matchers.rb', line 18
def have_selector(...) Matchers::HaveSelector.new(...) end
#have_sibling
RSpec matcher for whether sibling element(s) matching a given selector exist.
# File 'lib/capybara/rspec/matchers.rb', line 185
def have_sibling(...) Matchers::HaveSibling.new(...) end
#have_style(styles = nil, **options)
# File 'lib/capybara/rspec/matchers.rb', line 162
def have_style(styles = nil, ** ) Capybara::Helpers.warn "DEPRECATED: have_style is deprecated, please use match_style : #{Capybara::Helpers.filter_backtrace(caller)}" match_style(styles, ** ) end
#have_table(locator = nil, **options, &optional_filter_block)
RSpec matcher for table elements.
# File 'lib/capybara/rspec/matchers.rb', line 116
%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(text_or_type, *args, **options) Also known as: #have_content
RSpec matcher for text content.
#have_title(title, **options)
[ GitHub ]#have_unchecked_field(locator = nil, **options, &optional_filter_block)
RSpec matcher for unchecked fields.
#have_xpath(xpath, **options, &optional_filter_block)
RSpec matcher for whether elements(s) matching a given xpath selector exist.
#match_css(css, **options, &optional_filter_block)
RSpec matcher for whether the current element matches a given css selector.
# File 'lib/capybara/rspec/matchers.rb', line 80
%i[link button field select table element].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
RSpec matcher for whether the current element matches a given selector.
# File 'lib/capybara/rspec/matchers.rb', line 46
def match_selector(...) Matchers::MatchSelector.new(...) end
#match_style(styles = nil, **options)
RSpec matcher for element style.
# File 'lib/capybara/rspec/matchers.rb', line 154
def match_style(styles = nil, ** ) styles, = , {} if styles.nil? Matchers::MatchStyle.new(styles, ** ) end
#match_xpath(xpath, **options, &optional_filter_block)
RSpec matcher for whether the current element matches a given xpath selector.