Class: Capybara::Config

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/capybara/config.rb

Constant Summary collapse

OPTIONS =
%i[app reuse_server threadsafe default_wait_time server
default_driver javascript_driver allow_gumbo].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



23
24
25
26
# File 'lib/capybara/config.rb', line 23

def initialize
  @session_options = Capybara::SessionConfig.new
  @javascript_driver = nil
end

Instance Attribute Details

#allow_gumboObject

Returns the value of attribute allow_gumbo.



17
18
19
# File 'lib/capybara/config.rb', line 17

def allow_gumbo
  @allow_gumbo
end

#appObject

Returns the value of attribute app.



13
14
15
# File 'lib/capybara/config.rb', line 13

def app
  @app
end

#default_driverSymbol

Returns The name of the driver to use by default.

Returns:

  • (Symbol)

    The name of the driver to use by default



73
74
75
# File 'lib/capybara/config.rb', line 73

def default_driver
  @default_driver || :rack_test
end

#javascript_driverSymbol

Returns The name of the driver used when JavaScript is needed.

Returns:

  • (Symbol)

    The name of the driver used when JavaScript is needed



81
82
83
# File 'lib/capybara/config.rb', line 81

def javascript_driver
  @javascript_driver || :selenium
end

#reuse_serverObject

Returns the value of attribute reuse_server.



14
15
16
# File 'lib/capybara/config.rb', line 14

def reuse_server
  @reuse_server
end

#serverObject

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.



42
43
44
# File 'lib/capybara/config.rb', line 42

def server
  @server
end

#session_optionsObject (readonly)

Returns the value of attribute session_options.



15
16
17
# File 'lib/capybara/config.rb', line 15

def session_options
  @session_options
end

#threadsafeObject

Returns the value of attribute threadsafe.



14
15
16
# File 'lib/capybara/config.rb', line 14

def threadsafe
  @threadsafe
end

Instance Method Details

#deprecate(method, alternate_method, once = false) ⇒ Object



85
86
87
88
89
# File 'lib/capybara/config.rb', line 85

def deprecate(method, alternate_method, once = false)
  @deprecation_notified ||= {}
  warn "DEPRECATED: ##{method} is deprecated, please use ##{alternate_method} instead" unless once && @deprecation_notified[method]
  @deprecation_notified[method] = true
end