Class: SauceTest::Helpers::SauceTestOptions
- Inherits:
-
Object
- Object
- SauceTest::Helpers::SauceTestOptions
- Defined in:
- lib/sauce-test/helpers/sauce_test_options.rb
Instance Attribute Summary collapse
-
#browser ⇒ Object
readonly
Returns the value of attribute browser.
-
#job_name ⇒ Object
Returns the value of attribute job_name.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #browser_json ⇒ Object
-
#initialize(browser = nil) ⇒ SauceTestOptions
constructor
A new instance of SauceTestOptions.
- #parse_config(config_file) ⇒ Object
- #set_browser_version(version) ⇒ Object
- #set_os(os) ⇒ Object
Constructor Details
#initialize(browser = nil) ⇒ SauceTestOptions
Returns a new instance of SauceTestOptions.
15 16 17 |
# File 'lib/sauce-test/helpers/sauce_test_options.rb', line 15 def initialize(browser = nil) set_browser(browser || "firefox") end |
Instance Attribute Details
#browser ⇒ Object (readonly)
Returns the value of attribute browser.
8 9 10 |
# File 'lib/sauce-test/helpers/sauce_test_options.rb', line 8 def browser @browser end |
#job_name ⇒ Object
Returns the value of attribute job_name.
13 14 15 |
# File 'lib/sauce-test/helpers/sauce_test_options.rb', line 13 def job_name @job_name end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
8 9 10 |
# File 'lib/sauce-test/helpers/sauce_test_options.rb', line 8 def key @key end |
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
8 9 10 |
# File 'lib/sauce-test/helpers/sauce_test_options.rb', line 8 def timeout @timeout end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
8 9 10 |
# File 'lib/sauce-test/helpers/sauce_test_options.rb', line 8 def user @user end |
Instance Method Details
#browser_json ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/sauce-test/helpers/sauce_test_options.rb', line 29 def browser_json %W({ "username": "#{@user}",) + %W("access-key": "#{@key}",) + %W("job-name": "#{@job_name}",) + %W("os": "#{@browser['os']}",) + %W("browser": "#{@browser['name']}",) + %W("browser-major-version": "#{@browser['version']}" }) end |
#parse_config(config_file) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/sauce-test/helpers/sauce_test_options.rb', line 19 def parse_config(config_file) config = YAML::load_file config_file @user = config['login'] @key = config['key'] @timeout = config['timeout'] || 180 if(@user and @key) then true else false end end |
#set_browser_version(version) ⇒ Object
38 39 40 |
# File 'lib/sauce-test/helpers/sauce_test_options.rb', line 38 def set_browser_version(version) @browser['version'] = version end |
#set_os(os) ⇒ Object
42 43 44 |
# File 'lib/sauce-test/helpers/sauce_test_options.rb', line 42 def set_os(os) @browser['os'] = os end |