Class: Utilities
- Inherits:
-
Object
- Object
- Utilities
- Defined in:
- lib/utilities/utilities.rb
Instance Method Summary collapse
- #browser=(browser) ⇒ Object
- #browser_options=(*opts) ⇒ Object
- #delete_browser_options ⇒ Object
- #feature_path=(path) ⇒ Object
- #helper_path=(path) ⇒ Object
-
#initialize ⇒ Utilities
constructor
A new instance of Utilities.
- #overwrite_yaml ⇒ Object
- #page_path=(path) ⇒ Object
- #parallel_run(opts = nil) ⇒ Object
- #platform=(platform) ⇒ Object
- #run(opts = nil) ⇒ Object
- #spec_path=(path) ⇒ Object
- #url=(url) ⇒ Object
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 |
#browser_options=(*opts) ⇒ Object
46 47 48 49 |
# File 'lib/utilities/utilities.rb', line 46 def (*opts) @config['browser_options'] = opts.flatten overwrite_yaml end |
#delete_browser_options ⇒ Object
51 52 53 54 |
# File 'lib/utilities/utilities.rb', line 51 def @config.delete('browser_options') 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
66 67 68 |
# File 'lib/utilities/utilities.rb', line 66 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 |
#parallel_run(opts = nil) ⇒ Object
61 62 63 64 |
# File 'lib/utilities/utilities.rb', line 61 def parallel_run(opts = nil) command = File.directory?('spec') ? 'parallel_rspec spec/' : 'parallel_cucumber features' system "#{command} #{opts}" end |
#platform=(platform) ⇒ Object
41 42 43 44 |
# File 'lib/utilities/utilities.rb', line 41 def platform=(platform) @config['platform'] = platform overwrite_yaml end |
#run(opts = nil) ⇒ Object
56 57 58 59 |
# File 'lib/utilities/utilities.rb', line 56 def run(opts = nil) command = File.directory?('spec') ? 'rspec spec/' : 'cucumber features' system "#{command} #{opts}" 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 |