class Object

Public Class Methods

feature(*args, &block) click to toggle source
# File lib/capybara/rspec/features.rb, line 36
def self.feature(*args, &block)
  options = if args.last.is_a?(Hash) then args.pop else {} end
  options[:capybara_feature] = true
  options[:type] = :feature
  options[:caller] ||= caller
  args.push(options)

  #call describe on RSpec in case user has expose_dsl_globally set to false
  RSpec.describe(*args, &block)
end

Public Instance Methods

bases() click to toggle source
# File lib/capybara/spec/session/current_url_spec.rb, line 12
def bases
  @servers.map { |s| "http://#{s.host}:#{s.port}" }
end
be_an_invalid_element_error(session) click to toggle source
# File lib/capybara/spec/session/node_spec.rb, line 412
def be_an_invalid_element_error(session)
  satisfy { |error| session.driver.invalid_element_errors.any? { |e| error.is_a? e } }
end
should_be_on(server_index, path="/host", scheme="http") click to toggle source
# File lib/capybara/spec/session/current_url_spec.rb, line 16
def should_be_on server_index, path="/host", scheme="http"
  #This delay is to give fully async drivers (selenium w/chromedriver) time for the browser
  #to get to its destination - should be removed when we have a waiting current_url matcher
  sleep 0.1  # remove and adjust tests when a waiting current_url/path matcher is implemented
  # Check that we are on /host on the given server
  s = @servers[server_index]
  expect(@session.current_url.chomp('?')).to eq("#{scheme}://#{s.host}:#{s.port}#{path}")
  expect(@session.current_host).to eq("#{scheme}://#{s.host}") # no port
  expect(@session.current_path).to eq(path)
  if path == '/host'
    # Server should agree with us
    expect(@session).to have_content("Current host is #{scheme}://#{s.host}:#{s.port}")
  end
end