Class: ChemistryKit::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/chemistrykit/configuration.rb

Overview

Default configuration class

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Configuration

Returns a new instance of Configuration.



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/chemistrykit/configuration.rb', line 18

def initialize(hash)
  # set defaults
  @concurrency = 1
  @selenium_connect = {}
  @screenshot_on_fail = false
  @log = OpenStruct.new
  @log.path = 'evidence'
  @log.results_file = 'results_junit.xml'
  @log.format = 'JUnit'

  # overide with argument
  populate_with_hash hash
end

Instance Attribute Details

#base_urlObject

Returns the value of attribute base_url.



10
11
12
# File 'lib/chemistrykit/configuration.rb', line 10

def base_url
  @base_url
end

#concurrencyObject

Returns the value of attribute concurrency.



10
11
12
# File 'lib/chemistrykit/configuration.rb', line 10

def concurrency
  @concurrency
end

#logObject

Returns the value of attribute log.



14
15
16
# File 'lib/chemistrykit/configuration.rb', line 14

def log
  @log
end

#screenshot_on_failObject

Returns the value of attribute screenshot_on_fail.



10
11
12
# File 'lib/chemistrykit/configuration.rb', line 10

def screenshot_on_fail
  @screenshot_on_fail
end

#selenium_connectObject



39
40
41
42
43
44
45
46
# File 'lib/chemistrykit/configuration.rb', line 39

def selenium_connect
  # return the default log unless the sc log is set
  if @selenium_connect[:log].nil?
    @selenium_connect[:log] = @log.path
    return @selenium_connect
  end
  @selenium_connect
end

Class Method Details

.initialize_with_yaml(file) ⇒ Object



48
49
50
# File 'lib/chemistrykit/configuration.rb', line 48

def self.initialize_with_yaml(file)
  self.new symbolize_keys YAML.load_file file
end