Class: TM::Configuration

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

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.dataObject

Returns the value of attribute data.



6
7
8
# File 'lib/tm/configuration.rb', line 6

def data
  @data
end

.namesObject

Returns the value of attribute names.



6
7
8
# File 'lib/tm/configuration.rb', line 6

def names
  @names
end

.rootObject

Returns the value of attribute root.



6
7
8
# File 'lib/tm/configuration.rb', line 6

def root
  @root
end

.tagsObject

Returns the value of attribute tags.



6
7
8
# File 'lib/tm/configuration.rb', line 6

def tags
  @tags
end

Class Method Details

.configObject



17
18
19
20
21
22
23
# File 'lib/tm/configuration.rb', line 17

def config
  ['config', '../config'].map do |f|
    config_file = File.join( root, f, 'testingmachine.yml')
    return YAML.load_file(config_file) if File.exist?(config_file)
  end
  return {}
end

.load_config(config) ⇒ Object



33
34
35
36
37
# File 'lib/tm/configuration.rb', line 33

def load_config(config)
  ## load configuration for Capybara
  capybara_config = config && config['capybara']
  capybara_config.map { |f| Capybara.send((f[0] + '=').to_sym, f[1]) } if capybara_config
end

.load_setting_for_tags(tags = []) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/tm/configuration.rb', line 25

def load_setting_for_tags(tags=[])
  tags = tags.to_a.unshift(:all)
  tags.map do |tag|
    config = self.config['tags'] && self.config['tags'][tag.to_s]
    load_config(config)
  end
end