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)

@param options [Hash] optional param @option options [Numeric] :wait (Capybara.default_max_wait_time) Maximum wait time

# File lib/capybara/rspec/matchers.rb, line 308
def become_closed(options = {})
  BecomeClosed.new(options)
end
have_button(locator=nil, options={}, &optional_filter_block) click to toggle source

RSpec matcher for buttons See {Capybara::Node::Matchers#has_button?}

# File lib/capybara/rspec/matchers.rb, line 262
def have_button(locator=nil, options={}, &optional_filter_block)
  locator, options = nil, locator if locator.is_a? Hash
  HaveSelector.new(:button, locator, options, &optional_filter_block)
end
have_checked_field(locator=nil, options={}, &optional_filter_block) click to toggle source

RSpec matcher for checked fields See {Capybara::Node::Matchers#has_checked_field?}

# File lib/capybara/rspec/matchers.rb, line 276
def have_checked_field(locator=nil, options={}, &optional_filter_block)
  locator, options = nil, locator if locator.is_a? Hash
  HaveSelector.new(:field, locator, options.merge(checked: true), &optional_filter_block)
end
have_content(*args)
Alias for: have_text
have_css(css, options={}, &optional_filter_block) click to toggle source

RSpec matcher for whether elements(s) matching a given css selector exist See {Capybara::Node::Matchers#has_css?}

# File lib/capybara/rspec/matchers.rb, line 227
def have_css(css, options={}, &optional_filter_block)
  HaveSelector.new(:css, css, options, &optional_filter_block)
end
have_current_path(path, options = {}) click to toggle source

RSpec matcher for the current path See {Capybara::SessionMatchers#assert_current_path}

# File lib/capybara/rspec/matchers.rb, line 249
def have_current_path(path, options = {})
  HaveCurrentPath.new(path, options)
end
have_field(locator=nil, options={}, &optional_filter_block) click to toggle source

RSpec matcher for links See {Capybara::Node::Matchers#has_field?}

# File lib/capybara/rspec/matchers.rb, line 269
def have_field(locator=nil, options={}, &optional_filter_block)
  locator, options = nil, locator if locator.is_a? Hash
  HaveSelector.new(:field, locator, options, &optional_filter_block)
end
have_select(locator=nil, options={}, &optional_filter_block) click to toggle source

RSpec matcher for select elements See {Capybara::Node::Matchers#has_select?}

# File lib/capybara/rspec/matchers.rb, line 290
def have_select(locator=nil, options={}, &optional_filter_block)
  locator, options = nil, locator if locator.is_a? Hash
  HaveSelector.new(:select, locator, options, &optional_filter_block)
end
have_selector(*args, &optional_filter_block) click to toggle source

RSpec matcher for whether the element(s) matching a given selector exist See {Capybara::Node::Matcher#assert_selector}

# File lib/capybara/rspec/matchers.rb, line 200
def have_selector(*args, &optional_filter_block)
  HaveSelector.new(*args, &optional_filter_block)
end
have_table(locator=nil, options={}, &optional_filter_block) click to toggle source

RSpec matcher for table elements See {Capybara::Node::Matchers#has_table?}

# File lib/capybara/rspec/matchers.rb, line 297
def have_table(locator=nil, options={}, &optional_filter_block)
  locator, options = nil, locator if locator.is_a? Hash
  HaveSelector.new(:table, locator, options, &optional_filter_block)
end
have_text(*args) click to toggle source

RSpec matcher for text on the page See {Capybara::SessionMatchers#assert_text}

# File lib/capybara/rspec/matchers.rb, line 238
def have_text(*args)
  HaveText.new(*args)
end
Also aliased as: have_content
have_title(title, options = {}) click to toggle source
# File lib/capybara/rspec/matchers.rb, line 243
def have_title(title, options = {})
  HaveTitle.new(title, options)
end
have_unchecked_field(locator=nil, options={}, &optional_filter_block) click to toggle source

RSpec matcher for unchecked fields See {Capybara::Node::Matchers#has_unchecked_field?}

# File lib/capybara/rspec/matchers.rb, line 283
def have_unchecked_field(locator=nil, options={}, &optional_filter_block)
  locator, options = nil, locator if locator.is_a? Hash
  HaveSelector.new(:field, locator, options.merge(unchecked: true), &optional_filter_block)
end
have_xpath(xpath, options={}, &optional_filter_block) click to toggle source

RSpec matcher for whether elements(s) matching a given xpath selector exist See {Capybara::Node::Matchers#has_xpath?}

# File lib/capybara/rspec/matchers.rb, line 216
def have_xpath(xpath, options={}, &optional_filter_block)
  HaveSelector.new(:xpath, xpath, options, &optional_filter_block)
end
match_css(css, options={}, &optional_filter_block) click to toggle source

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

# File lib/capybara/rspec/matchers.rb, line 232
def match_css(css, options={}, &optional_filter_block)
  MatchSelector.new(:css, css, options, &optional_filter_block)
end
match_selector(*args, &optional_filter_block) 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 206
def match_selector(*args, &optional_filter_block)
  MatchSelector.new(*args, &optional_filter_block)
end
match_xpath(xpath, options={}, &optional_filter_block) click to toggle source

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

# File lib/capybara/rspec/matchers.rb, line 221
def match_xpath(xpath, options={}, &optional_filter_block)
  MatchSelector.new(:xpath, xpath, options, &optional_filter_block)
end