Class: Utilities

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

Instance Method Summary collapse

Constructor Details

#initialize ⇒ Utilities

Returns a new instance of Utilities.



6
7
8
9
# File 'lib/utilities/utilities.rb', line 6

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

Instance Method Details

#browser=(browser) ⇒ Object



11
12
13
14
# File 'lib/utilities/utilities.rb', line 11

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

#feature_path=(path) ⇒ Object



26
27
28
29
# File 'lib/utilities/utilities.rb', line 26

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

#helper_path=(path) ⇒ Object



31
32
33
34
# File 'lib/utilities/utilities.rb', line 31

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

#overwrite_yaml ⇒ Object



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

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

#page_path=(path) ⇒ Object



16
17
18
19
# File 'lib/utilities/utilities.rb', line 16

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

#run ⇒ Object



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

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

#spec_path=(path) ⇒ Object



21
22
23
24
# File 'lib/utilities/utilities.rb', line 21

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

#url=(url) ⇒ Object



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

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