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.



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

def initialize(hash)
  # set defaults
  @concurrency = 1
  @retries_on_failure = 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.



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

def log
  @log
end

#retries_on_failureObject

Returns the value of attribute retries_on_failure.



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

def retries_on_failure
  @retries_on_failure
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



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

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



50
51
52
# File 'lib/chemistrykit/configuration.rb', line 50

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