Class: TestingBot::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/testingbot/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Config

Returns a new instance of Config.



20
21
22
23
24
25
# File 'lib/testingbot/config.rb', line 20

def initialize(options = {})
  @options = default_options
  @options = @options.merge(load_config_file)
  @options = @options.merge(load_config_environment)
  @options = @options.merge(options)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



18
19
20
# File 'lib/testingbot/config.rb', line 18

def options
  @options
end

Instance Method Details

#[](key) ⇒ Object



27
28
29
# File 'lib/testingbot/config.rb', line 27

def [](key)
  @options[key]
end

#[]=(key, value) ⇒ Object



35
36
37
# File 'lib/testingbot/config.rb', line 35

def []=(key, value)
  @options[key] = value
end

#add_options(options = {}) ⇒ Object



31
32
33
# File 'lib/testingbot/config.rb', line 31

def add_options(options = {})
  @options = @options.merge(options)
end

#client_keyObject



49
50
51
# File 'lib/testingbot/config.rb', line 49

def client_key
  @options[:client_key]
end

#client_secretObject



53
54
55
# File 'lib/testingbot/config.rb', line 53

def client_secret
  @options[:client_secret]
end

#desired_capabilitiesObject



57
58
59
60
61
62
63
# File 'lib/testingbot/config.rb', line 57

def desired_capabilities
  # check if instance of Selenium::WebDriver::Remote::Capabilities
  unless @options[:desired_capabilities].instance_of?(Hash) || @options[:desired_capabilities].instance_of?(Array)
    return symbolize_keys @options[:desired_capabilities].as_json
  end
  @options[:desired_capabilities]
end

#require_tunnel(host = "127.0.0.1", port = 4445) ⇒ Object



43
44
45
46
47
# File 'lib/testingbot/config.rb', line 43

def require_tunnel(host = "127.0.0.1", port = 4445)
  @options[:require_tunnel] = true
  @options[:host] = host
  @options[:port] = port
end