class Capybara::Config

Constants

OPTIONS

Attributes

app[RW]
default_driver[W]
javascript_driver[W]
reuse_server[RW]
server[R]

Return the proc that Capybara will call to run the Rack application. The block returned receives a rack app, port, and host/ip and should run a Rack handler By default, Capybara will try to use puma.

session_options[R]
threadsafe[R]

Public Class Methods

new() click to toggle source
# File lib/capybara/config.rb, line 21
def initialize
  @session_options = Capybara::SessionConfig.new
end

Public Instance Methods

default_driver() click to toggle source

@return [Symbol] The name of the driver to use by default

# File lib/capybara/config.rb, line 69
def default_driver
  @default_driver || :rack_test
end
deprecate(method, alternate_method, once = false) click to toggle source
# File lib/capybara/config.rb, line 81
def deprecate(method, alternate_method, once = false)
  @deprecation_notified ||= {}
  warn "DEPRECATED: ##{method} is deprecated, please use ##{alternate_method} instead" unless once and @deprecation_notified[method]
  @deprecation_notified[method] = true
end
javascript_driver() click to toggle source

@return [Symbol] The name of the driver used when JavaScript is needed

# File lib/capybara/config.rb, line 77
def javascript_driver
  @javascript_driver || :selenium
end
server=(name) click to toggle source

Set the server to use.

Capybara.server = :webrick
Capybara.server = :puma, { Silent: true }

@overload server=(name)

@param [Symbol] name     Name of the server type to use

@overload server=([name, options])

@param [Symbol] name Name of the server type to use
@param [Hash] options Options to pass to the server block

@see register_server

# File lib/capybara/config.rb, line 54
def server=(name)
  name, options = *name if name.is_a? Array
  @server = if name.respond_to? :call
    name
  elsif options
    proc { |app, port, host| Capybara.servers[name.to_sym].call(app, port, host, options) }
  else
    Capybara.servers[name.to_sym]
  end
end
threadsafe=(bool) click to toggle source
# File lib/capybara/config.rb, line 27
def threadsafe=(bool)
  raise "Threadsafe setting cannot be changed once a session is created" if (bool != threadsafe) && Session.instance_created?
  @threadsafe = bool
end