Class: Utilities

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

Instance Method Summary collapse

Constructor Details

#initializeUtilities

Returns a new instance of Utilities.



4
5
6
7
# File 'lib/utilities/utilities.rb', line 4

def initialize
  @path = 'config/config.yml'
  @config = YAML.load_file(@path)
end

Instance Method Details

#browser=(browser) ⇒ Object



9
10
11
12
# File 'lib/utilities/utilities.rb', line 9

def browser=(browser)
  @config['browser'] = browser
  overwrite_yaml
end

#feature_path=(path) ⇒ Object



24
25
26
27
# File 'lib/utilities/utilities.rb', line 24

def feature_path=(path)
  @config['feature_path'] = path
  overwrite_yaml
end

#overwrite_yamlObject



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

def overwrite_yaml
  File.open(@path, 'w') { |file| YAML.dump(@config, file) }
end

#page_path=(path) ⇒ Object



14
15
16
17
# File 'lib/utilities/utilities.rb', line 14

def page_path=(path)
  @config['page_path'] = path
  overwrite_yaml
end

#runObject



34
35
36
37
38
39
40
# File 'lib/utilities/utilities.rb', line 34

def run
  if File.directory? 'spec'
    system 'rspec spec/'
  else
    system 'cucumber features'
  end
end

#spec_path=(path) ⇒ Object



19
20
21
22
# File 'lib/utilities/utilities.rb', line 19

def spec_path=(path)
  @config['spec_path'] = path
  overwrite_yaml
end

#url=(url) ⇒ Object



29
30
31
32
# File 'lib/utilities/utilities.rb', line 29

def url=(url)
  @config['url'] = url
  overwrite_yaml
end