Class: SauceTest::Helpers::SauceTestOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/sauce-test/helpers/sauce_test_options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#browserObject (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_nameObject

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

#keyObject (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

#timeoutObject (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

#userObject (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_jsonObject



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