class SauceRSpec::Config
Attributes
caps[R]
concurrency_timeout[R]
host[RW]
key[RW]
opts[RW]
port[RW]
user[RW]
Public Class Methods
new()
click to toggle source
# File lib/sauce_rspec/config.rb, line 8 def initialize clear end
Public Instance Methods
caps=(value)
click to toggle source
# File lib/sauce_rspec/config.rb, line 26 def caps= value fail 'caps must be an array' unless value && value.is_a?(Array) @caps = value end
clear()
click to toggle source
# File lib/sauce_rspec/config.rb, line 39 def clear @caps = [] @opts = {} @user = sauce_user @key = sauce_key @host = 'ondemand.saucelabs.com' @port = '80' end
concurrency_timeout=(value)
click to toggle source
# File lib/sauce_rspec/config.rb, line 21 def concurrency_timeout= value fail 'concurrency_timeout must be a numeric' unless value.is_a?(Numeric) @concurrency_timeout = value end
default_caps(default)
click to toggle source
After defining the specific caps, the default_caps
method may be used to add default values to all previously defined caps. If a cap is already present then the default will be ignored.
# File lib/sauce_rspec/config.rb, line 34 def default_caps default fail 'default caps must be a hash' unless default && default.is_a?(Hash) @caps.each { |cap| cap.merge!(default) { |_key, oldval, _newval| oldval } } end
sauce?()
click to toggle source
We're able to run on sauce if we have a user, key, host, and port caps and opts aren't required to run on sauce because the user may provide the caps outside of the SauceRSpec
config.
# File lib/sauce_rspec/config.rb, line 51 def sauce? !!(@user && @key && @host && @port) end
to_h()
click to toggle source
# File lib/sauce_rspec/config.rb, line 55 def to_h { caps: @caps.dup, opts: @opts.dup, user: @user.dup, key: @key.dup, host: @host.dup, port: @port.dup } end
url()
click to toggle source
Sauce URL
# File lib/sauce_rspec/config.rb, line 13 def url fail 'Missing user' unless user fail 'Missing key' unless key fail 'Missing host' unless host fail 'Missing port' unless port "http://#{user}:#{key}@#{host}:#{port}/wd/hub" end