Module: Utilities
- Defined in:
- lib/utilities/utilities.rb
Class Method Summary collapse
-
.batch_update(**settings) ⇒ Object
Set multiple config keys in a single YAML write.
- .browser=(browser) ⇒ Object
- .browser_options=(opts) ⇒ Object
- .debug=(enabled) ⇒ Object
- .delete_browser_options ⇒ Object
- .feature_path=(path) ⇒ Object
- .helper_path=(path) ⇒ Object
- .llm_api_key=(key) ⇒ Object
- .llm_model=(model) ⇒ Object
- .llm_provider=(provider) ⇒ Object
- .llm_url=(url) ⇒ Object
- .page_path=(path) ⇒ Object
- .parallel_run(opts = nil, _settings = nil) ⇒ Object
- .platform=(platform) ⇒ Object
- .run(opts = nil) ⇒ Object
- .spec_path=(path) ⇒ Object
- .timeout=(seconds) ⇒ Object
- .url=(url) ⇒ Object
- .viewport=(dimensions) ⇒ Object
Class Method Details
.batch_update(**settings) ⇒ Object
Set multiple config keys in a single YAML write. Usage: Utilities.batch_update(browser: ‘chrome’, timeout: 30)
79 80 81 82 |
# File 'lib/utilities/utilities.rb', line 79 def batch_update(**settings) settings.each { |key, value| config[key.to_s] = value } overwrite_yaml end |
.browser=(browser) ⇒ Object
9 10 11 |
# File 'lib/utilities/utilities.rb', line 9 def browser=(browser) set('browser', browser) end |
.browser_options=(opts) ⇒ Object
46 47 48 |
# File 'lib/utilities/utilities.rb', line 46 def (opts) set('browser_options', Array(opts).flatten) end |
.debug=(enabled) ⇒ Object
71 72 73 74 75 |
# File 'lib/utilities/utilities.rb', line 71 def debug=(enabled) config['debug'] ||= {} config['debug']['enabled'] = enabled overwrite_yaml end |
.delete_browser_options ⇒ Object
50 51 52 53 |
# File 'lib/utilities/utilities.rb', line 50 def config.delete('browser_options') overwrite_yaml end |
.feature_path=(path) ⇒ Object
21 22 23 |
# File 'lib/utilities/utilities.rb', line 21 def feature_path=(path) set('feature_path', path) end |
.helper_path=(path) ⇒ Object
25 26 27 |
# File 'lib/utilities/utilities.rb', line 25 def helper_path=(path) set('helper_path', path) end |
.llm_api_key=(key) ⇒ Object
59 60 61 |
# File 'lib/utilities/utilities.rb', line 59 def llm_api_key=(key) set('llm_api_key', key) end |
.llm_model=(model) ⇒ Object
63 64 65 |
# File 'lib/utilities/utilities.rb', line 63 def llm_model=(model) set('llm_model', model) end |
.llm_provider=(provider) ⇒ Object
55 56 57 |
# File 'lib/utilities/utilities.rb', line 55 def llm_provider=(provider) set('llm_provider', provider) end |
.llm_url=(url) ⇒ Object
67 68 69 |
# File 'lib/utilities/utilities.rb', line 67 def llm_url=(url) set('llm_url', url) end |
.page_path=(path) ⇒ Object
13 14 15 |
# File 'lib/utilities/utilities.rb', line 13 def page_path=(path) set('page_path', path) end |
.parallel_run(opts = nil, _settings = nil) ⇒ Object
89 90 91 92 |
# File 'lib/utilities/utilities.rb', line 89 def parallel_run(opts = nil, _settings = nil) command = File.directory?('spec') ? 'parallel_rspec spec/' : 'parallel_cucumber features' system "#{command} #{opts}" end |
.platform=(platform) ⇒ Object
42 43 44 |
# File 'lib/utilities/utilities.rb', line 42 def platform=(platform) set('platform', platform) end |
.run(opts = nil) ⇒ Object
84 85 86 87 |
# File 'lib/utilities/utilities.rb', line 84 def run(opts = nil) command = File.directory?('spec') ? 'rspec spec/' : 'cucumber features' system "#{command} #{opts}" end |
.spec_path=(path) ⇒ Object
17 18 19 |
# File 'lib/utilities/utilities.rb', line 17 def spec_path=(path) set('spec_path', path) end |
.timeout=(seconds) ⇒ Object
33 34 35 |
# File 'lib/utilities/utilities.rb', line 33 def timeout=(seconds) set('timeout', seconds.to_i) end |
.url=(url) ⇒ Object
29 30 31 |
# File 'lib/utilities/utilities.rb', line 29 def url=(url) set('url', url) end |
.viewport=(dimensions) ⇒ Object
37 38 39 40 |
# File 'lib/utilities/utilities.rb', line 37 def (dimensions) width, height = dimensions.split('x').map(&:to_i) set('viewport', { 'width' => width, 'height' => height }) end |