module Capybara::RSpecMatchers

Public Instance Methods

become_closed(**options) click to toggle source

Wait for window to become closed.

@example

expect(window).to become_closed(wait: 0.8)

@option options [Numeric] :wait Maximum wait time. Defaults to {Capybara.configure default_max_wait_time}

# File lib/capybara/rspec/matchers.rb, line 198
def become_closed(**options)
  Matchers::BecomeClosed.new(options)
end
have_all_of_selectors(...) click to toggle source

RSpec matcher for whether the element(s) matching a group of selectors exist.

@see Capybara::Node::Matchers#assert_all_of_selectors

# File lib/capybara/rspec/matchers.rb, line 25
def have_all_of_selectors(...)
  Matchers::HaveAllSelectors.new(...)
end
have_ancestor(...) click to toggle source

RSpec matcher for whether ancestor element(s) matching a given selector exist.

@see Capybara::Node::Matchers#assert_ancestor

# File lib/capybara/rspec/matchers.rb, line 187
def have_ancestor(...)
  Matchers::HaveAncestor.new(...)
end
have_any_of_selectors(...) click to toggle source

RSpec matcher for whether the element(s) matching any of a group of selectors exist.

@see Capybara::Node::Matchers#assert_any_of_selectors

# File lib/capybara/rspec/matchers.rb, line 39
def have_any_of_selectors(...)
  Matchers::HaveAnySelectors.new(...)
end
have_content(text_or_type, *args, **options)
Alias for: have_text
have_current_path(path, **options, &optional_filter_block) click to toggle source

RSpec matcher for the current path.

@see Capybara::SessionMatchers#assert_current_path

# File lib/capybara/rspec/matchers.rb, line 142
def have_current_path(path, **options, &optional_filter_block)
  Matchers::HaveCurrentPath.new(path, **options, &optional_filter_block)
end
have_none_of_selectors(...) click to toggle source

RSpec matcher for whether no element(s) matching a group of selectors exist.

@see Capybara::Node::Matchers#assert_none_of_selectors

# File lib/capybara/rspec/matchers.rb, line 32
def have_none_of_selectors(...)
  Matchers::HaveNoSelectors.new(...)
end
have_selector(...) click to toggle source

RSpec matcher for whether the element(s) matching a given selector exist.

@see Capybara::Node::Matchers#assert_selector

# File lib/capybara/rspec/matchers.rb, line 18
def have_selector(...)
  Matchers::HaveSelector.new(...)
end
have_sibling(...) click to toggle source

RSpec matcher for whether sibling element(s) matching a given selector exist.

@see Capybara::Node::Matchers#assert_sibling

# File lib/capybara/rspec/matchers.rb, line 180
def have_sibling(...)
  Matchers::HaveSibling.new(...)
end
have_style(styles = nil, **options) click to toggle source

@deprecated

# File lib/capybara/rspec/matchers.rb, line 157
def have_style(styles = nil, **options)
  Capybara::Helpers.warn "DEPRECATED: have_style is deprecated, please use match_style : #{Capybara::Helpers.filter_backtrace(caller)}"
  match_style(styles, **options)
end
have_text(text_or_type, *args, **options) click to toggle source

RSpec matcher for text content.

@see Capybara::Node::Matchers#assert_text

# File lib/capybara/rspec/matchers.rb, line 130
def have_text(text_or_type, *args, **options)
  Matchers::HaveText.new(text_or_type, *args, **options)
end
Also aliased as: have_content
have_title(title, **options) click to toggle source
# File lib/capybara/rspec/matchers.rb, line 135
def have_title(title, **options)
  Matchers::HaveTitle.new(title, **options)
end
match_selector(...) click to toggle source

RSpec matcher for whether the current element matches a given selector.

@see Capybara::Node::Matchers#assert_matches_selector

# File lib/capybara/rspec/matchers.rb, line 46
def match_selector(...)
  Matchers::MatchSelector.new(...)
end
match_style(styles = nil, **options) click to toggle source

RSpec matcher for element style.

@see Capybara::Node::Matchers#matches_style?

# File lib/capybara/rspec/matchers.rb, line 149
def match_style(styles = nil, **options)
  styles, options = options, {} if styles.nil?
  Matchers::MatchStyle.new(styles, **options)
end