class Object

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 663
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')
  # Check that we are on /host on the given server
  s = @servers[server_index]

  expect(@session).to have_current_path("#{scheme}://#{s.host}:#{s.port}#{path}", url: true)

  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)
  # Server should agree with us
  expect(@session).to have_content("Current host is #{scheme}://#{s.host}:#{s.port}") if path == '/host'
end
win_size() click to toggle source
# File lib/capybara/spec/session/window/window_spec.rb, line 90
def win_size
  @session.evaluate_script('[window.outerWidth || window.innerWidth, window.outerHeight || window.innerHeight]')
end
with_os_path_separators(path) click to toggle source
# File lib/capybara/spec/session/attach_file_spec.rb, line 185
def with_os_path_separators(path)
  Gem.win_platform? ? path.to_s.tr('/', '\\') : path.to_s
end