sauce 0.17.3.alpha1 → 0.17.3.alpha2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/sauce/config.rb CHANGED
@@ -45,13 +45,16 @@ module Sauce
45
45
 
46
46
  def initialize(opts={})
47
47
  @opts = {}
48
+ @undefaulted_opts = {}
48
49
  if opts != false
49
50
  @opts.merge! DEFAULT_OPTIONS
50
- @opts.merge! load_options_from_yaml
51
- @opts.merge! load_options_from_environment
52
- @opts.merge! load_options_from_heroku
53
- @opts.merge! Sauce.get_config.opts rescue {}
54
- @opts.merge! opts
51
+
52
+ @undefaulted_opts.merge! load_options_from_yaml
53
+ @undefaulted_opts.merge! load_options_from_environment
54
+ @undefaulted_opts.merge! load_options_from_heroku
55
+ @undefaulted_opts.merge! Sauce.get_config.opts rescue {}
56
+ @undefaulted_opts.merge! opts
57
+ @opts.merge! @undefaulted_opts
55
58
  end
56
59
  end
57
60
 
@@ -97,6 +100,9 @@ module Sauce
97
100
  end
98
101
 
99
102
  def browser
103
+ if @undefaulted_opts[:browser]
104
+ return @undefaulted_opts[:browser]
105
+ end
100
106
  if @opts[:browsers]
101
107
  @opts[:browsers][0][1]
102
108
  else
@@ -105,6 +111,9 @@ module Sauce
105
111
  end
106
112
 
107
113
  def os
114
+ if @undefaulted_opts[:os]
115
+ return @undefaulted_opts[:os]
116
+ end
108
117
  if @opts[:browsers]
109
118
  @opts[:browsers][0][0]
110
119
  else
@@ -113,6 +122,9 @@ module Sauce
113
122
  end
114
123
 
115
124
  def browser_version
125
+ if @undefaulted_opts[:browser_version]
126
+ return @undefaulted_opts[:browser_version]
127
+ end
116
128
  if @opts[:browsers]
117
129
  @opts[:browsers][0][2]
118
130
  else
data/sauce.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{sauce}
5
- s.version = "0.17.3.alpha1"
5
+ s.version = "0.17.3.alpha2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Sean Grove", "Eric Allen", "Steven Hazel"]
data/test/test_config.rb CHANGED
@@ -44,6 +44,14 @@ class TestConfig < Test::Unit::TestCase
44
44
  assert_equal [["A", "B", "C"]], config.browsers
45
45
  end
46
46
 
47
+ def test_default_to_first_item_in_browsers
48
+ Sauce.config {|c| c.browsers = [["OS_FOO", "BROWSER_FOO", "VERSION_FOO"]] }
49
+ config = Sauce::Config.new
50
+ assert_equal "OS_FOO", config.os
51
+ assert_equal "BROWSER_FOO", config.browser
52
+ assert_equal "VERSION_FOO", config.browser_version
53
+ end
54
+
47
55
  def test_boolean_flags
48
56
  config = Sauce::Config.new
49
57
  config.foo = true
@@ -67,6 +75,14 @@ class TestConfig < Test::Unit::TestCase
67
75
  assert_not_equal "A", Sauce::Config.new.os
68
76
  end
69
77
 
78
+ def test_override
79
+ Sauce.config {|c| c.browsers = [["OS_FOO", "BROWSER_FOO", "VERSION_FOO"]] }
80
+ config = Sauce::Config.new(:os => "OS_BAR", :browser => "BROWSER_BAR", :browser_version => "VERSION_BAR")
81
+ assert_equal "OS_BAR", config.os
82
+ assert_equal "BROWSER_BAR", config.browser
83
+ assert_equal "VERSION_BAR", config.browser_version
84
+ end
85
+
70
86
  def test_clears_config
71
87
  Sauce.config {|c|}
72
88
  assert_equal [["Windows 2003", "firefox", "3.6."]], Sauce::Config.new.browsers
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sauce
3
3
  version: !ruby/object:Gem::Version
4
- hash: -3702664618
4
+ hash: -3702664624
5
5
  prerelease: 7
6
6
  segments:
7
7
  - 0
8
8
  - 17
9
9
  - 3
10
10
  - alpha
11
- - 1
12
- version: 0.17.3.alpha1
11
+ - 2
12
+ version: 0.17.3.alpha2
13
13
  platform: ruby
14
14
  authors:
15
15
  - Sean Grove