sauce 2.2.2 → 2.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/bin/sauce CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
-
3
2
  require 'rubygems'
4
3
  require 'cmdparse'
5
4
  require 'yaml'
@@ -26,7 +25,12 @@ end
26
25
  connect = ConnectCommand.new('connect', false)
27
26
  connect.short_desc = 'Connect a Sauce Connect tunnel'
28
27
  connect.set_execution_block do |args|
29
- require 'sauce/connect'
28
+ begin
29
+ require 'sauce/connect'
30
+ rescue LoadError
31
+ puts "Please install the sauce-connect gem (`gem install sauce-connect`) in order to use Sauce Connect"
32
+ exit 1
33
+ end
30
34
  require 'sauce/config'
31
35
  config = Sauce::Config.new
32
36
  command = "#{Sauce::Connect.connect_command} #{config.username} #{config.access_key} #{ARGV[1 .. -1]}"
data/lib/sauce.rb CHANGED
@@ -5,4 +5,3 @@ require 'sauce/client'
5
5
  require 'sauce/config'
6
6
  require 'sauce/selenium'
7
7
  require 'sauce/integrations'
8
- require 'sauce/connect'
@@ -1,7 +1,6 @@
1
1
  require 'capybara'
2
2
 
3
3
  require 'sauce/config'
4
- require 'sauce/connect'
5
4
  require 'sauce/selenium'
6
5
 
7
6
 
@@ -10,6 +9,13 @@ $sauce_tunnel = nil
10
9
  module Sauce
11
10
  module Capybara
12
11
  def connect_tunnel(options={})
12
+ begin
13
+ require 'sauce/connect'
14
+ rescue LoadError
15
+ puts 'Please install the `sauce-connect` gem if you intend on using Sauce Connect with your tests!'
16
+ raise
17
+ end
18
+
13
19
  unless $sauce_tunnel.nil?
14
20
  return $sauce_tunnel
15
21
  end
data/lib/sauce/config.rb CHANGED
@@ -34,7 +34,7 @@ module Sauce
34
34
  ENVIRONMENT_VARIABLES = %w{SAUCE_HOST SAUCE_PORT SAUCE_BROWSER_URL SAUCE_USERNAME
35
35
  SAUCE_ACCESS_KEY SAUCE_OS SAUCE_BROWSER SAUCE_BROWSER_VERSION SAUCE_JOB_NAME
36
36
  SAUCE_FIREFOX_PROFILE_URL SAUCE_USER_EXTENSIONS_URL
37
- SAUCE_ONDEMAND_BROWSERS}
37
+ SAUCE_ONDEMAND_BROWSERS SAUCE_USERNAME SAUCE_API_KEY}
38
38
 
39
39
  PLATFORMS = {
40
40
  "Windows 2003" => "WINDOWS",
@@ -237,13 +237,13 @@ module Sauce
237
237
  opts[:port] = env['SAUCE_PORT']
238
238
  opts[:browser_url] = env['SAUCE_BROWSER_URL']
239
239
 
240
- opts[:username] = env['SAUCE_USERNAME']
241
- opts[:access_key] = env['SAUCE_ACCESS_KEY']
240
+ opts[:username] = env['SAUCE_USERNAME'] || env['SAUCE_USER_NAME']
241
+ opts[:access_key] = env['SAUCE_ACCESS_KEY'] || env['SAUCE_API_KEY']
242
242
 
243
243
  opts[:os] = env['SAUCE_OS']
244
244
  opts[:browser] = env['SAUCE_BROWSER']
245
245
  opts[:browser_version] = env['SAUCE_BROWSER_VERSION']
246
- opts[:job_name] = env['SAUCE_JOB_NAME']
246
+ opts[:job_name] = env['SAUCE_JOB_NAME'] || env['JOB_NAME']
247
247
 
248
248
  opts[:firefox_profile_url] = env['SAUCE_FIREFOX_PROFILE_URL']
249
249
  opts[:user_extensions_url] = env['SAUCE_USER_EXTENSIONS_URL']
data/lib/sauce/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Sauce
3
- MAJOR_VERSION = '2.2'
3
+ MAJOR_VERSION = '2.3'
4
4
  end
@@ -1,4 +1,6 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
1
+ require 'spec_helper'
2
+ require 'sauce/connect'
3
+
2
4
 
3
5
 
4
6
  describe 'Sauce::Connect integration testing' do
@@ -1,5 +1,6 @@
1
1
  require 'spec_helper'
2
2
  require 'sauce/capybara'
3
+ require 'sauce/connect'
3
4
 
4
5
  describe Sauce::Capybara do
5
6
  describe '#connect_tunnel' do
@@ -37,6 +38,7 @@ describe Sauce::Capybara do
37
38
  end
38
39
 
39
40
  describe Sauce::Capybara::Driver do
41
+
40
42
  let(:app) { double('Mock App for Driver') }
41
43
  let(:driver) { Sauce::Capybara::Driver.new(app) }
42
44
 
@@ -60,6 +62,8 @@ describe Sauce::Capybara do
60
62
  end
61
63
 
62
64
  describe '#browser' do
65
+ let(:driver) { Sauce::Capybara::Driver.new(app) }
66
+
63
67
  before :each do
64
68
  # Stub out the selenium driver startup
65
69
  Sauce::Selenium2.stub(:new).and_return(nil)
@@ -67,9 +71,7 @@ describe Sauce::Capybara do
67
71
  context 'when tunneling is disabled' do
68
72
  it 'should not call #connect_tunnel' do
69
73
  Sauce::Capybara.should_receive(:connect_tunnel).never
70
- Sauce.config do |c|
71
- c[:start_tunnel] = false
72
- end
74
+ Sauce.stub(:get_config) {{:start_tunnel => false}}
73
75
 
74
76
  driver.browser
75
77
  end
@@ -103,6 +103,25 @@ describe Sauce::Config do
103
103
  'browser' => 'firefox'}
104
104
  end
105
105
 
106
+ it 'should create a browser string from the environment set by the jenkins plugin' do
107
+ ENV['SAUCE_USER_NAME'] = 'test_user'
108
+ ENV['SAUCE_API_KEY'] = 'test_access'
109
+ ENV['SAUCE_OS'] = 'Linux'
110
+ ENV['SAUCE_BROWSER'] = 'firefox'
111
+ ENV['SAUCE_BROWSER_VERSION'] = '3.'
112
+ ENV['JOB_NAME'] = 'Named Ruby Job'
113
+
114
+ config = Sauce::Config.new
115
+ browser_data = JSON.parse(config.to_browser_string)
116
+ browser_data.should == {'name' => 'Named Ruby Job',
117
+ 'access-key' => 'test_access',
118
+ 'os' => 'Linux',
119
+ 'username' => 'test_user',
120
+ 'browser-version' => '3.',
121
+ 'browser' => 'firefox'}
122
+
123
+ end
124
+
106
125
  it 'should create a browser string from parameters' do
107
126
  config = Sauce::Config.new(:username => 'test_user',
108
127
  :access_key => 'test_access',
@@ -155,6 +174,16 @@ describe Sauce::Config do
155
174
  end
156
175
 
157
176
  describe '#to_desired_capabilities' do
177
+ context 'with custom sauce options' do
178
+ context 'max-duration' do
179
+ subject do
180
+ Sauce::Config.new(:'max-duration' => 600).to_desired_capabilities
181
+ end
182
+
183
+ it { should have_key :'max-duration' }
184
+ end
185
+ end
186
+
158
187
  context 'platforms' do
159
188
  it 'should refer to Windows 2003 as WINDOWS' do
160
189
  config = Sauce::Config.new(:os => "Windows 2003")
@@ -214,13 +243,17 @@ end
214
243
  describe Sauce do
215
244
  describe '#get_config' do
216
245
  context 'when #config has never been called' do
217
- # See: <https://github.com/saucelabs/sauce_ruby/issues/59>
246
+ # See: <https://github.com/sauce-labs/sauce_ruby/issues/59>
218
247
  before :each do
219
248
  # This is kind of hack-ish, but the best way I can think to properly
220
249
  # prevent this class variable from existing
221
250
  Sauce.instance_variable_set(:@cfg, nil)
222
251
  end
223
252
 
253
+ after :all do
254
+
255
+ end
256
+
224
257
  it 'should return a newly created Sauce::Config' do
225
258
  dummy_config = double('Sauce::Config')
226
259
  Sauce::Config.should_receive(:new).and_return(dummy_config)
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,8 @@
1
- $:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
2
- $:.unshift File.expand_path(File.dirname(__FILE__) + '/../gems/sauce-jasmine/lib')
3
- $:.unshift File.expand_path(File.dirname(__FILE__) + '/../gems/sauce-cucumber/lib')
1
+ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
2
+
3
+ ['sauce-jasmine', 'sauce-cucumber', 'sauce-connect'].each do |gem|
4
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../gems/#{gem}/lib"))
5
+ end
4
6
 
5
7
  require 'sauce'
6
8
 
metadata CHANGED
@@ -1,23 +1,24 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sauce
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
- - Eric Allen
9
- - Sean Grove
8
+ - Dylan Lacey
10
9
  - Steven Hazel
11
10
  - R. Tyler Croy
12
11
  - Santiago Suarez Ordoñez
12
+ - Eric Allen
13
+ - Sean Grove
13
14
  autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
- date: 2012-12-18 00:00:00.000000000 Z
17
+ date: 2013-02-27 00:00:00.000000000 Z
17
18
  dependencies:
18
19
  - !ruby/object:Gem::Dependency
19
20
  name: net-http-persistent
20
- requirement: &16379820 !ruby/object:Gem::Requirement
21
+ requirement: !ruby/object:Gem::Requirement
21
22
  none: false
22
23
  requirements:
23
24
  - - ! '>='
@@ -25,21 +26,31 @@ dependencies:
25
26
  version: '0'
26
27
  type: :runtime
27
28
  prerelease: false
28
- version_requirements: *16379820
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ! '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
29
35
  - !ruby/object:Gem::Dependency
30
36
  name: capybara
31
- requirement: &16378080 !ruby/object:Gem::Requirement
37
+ requirement: !ruby/object:Gem::Requirement
32
38
  none: false
33
39
  requirements:
34
40
  - - ~>
35
41
  - !ruby/object:Gem::Version
36
- version: '1.0'
42
+ version: 1.1.0
37
43
  type: :runtime
38
44
  prerelease: false
39
- version_requirements: *16378080
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ none: false
47
+ requirements:
48
+ - - ~>
49
+ - !ruby/object:Gem::Version
50
+ version: 1.1.0
40
51
  - !ruby/object:Gem::Dependency
41
52
  name: rest-client
42
- requirement: &16376340 !ruby/object:Gem::Requirement
53
+ requirement: !ruby/object:Gem::Requirement
43
54
  none: false
44
55
  requirements:
45
56
  - - ! '>='
@@ -47,10 +58,15 @@ dependencies:
47
58
  version: '0'
48
59
  type: :runtime
49
60
  prerelease: false
50
- version_requirements: *16376340
61
+ version_requirements: !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
51
67
  - !ruby/object:Gem::Dependency
52
68
  name: net-ssh
53
- requirement: &16375080 !ruby/object:Gem::Requirement
69
+ requirement: !ruby/object:Gem::Requirement
54
70
  none: false
55
71
  requirements:
56
72
  - - ! '>='
@@ -58,10 +74,15 @@ dependencies:
58
74
  version: '0'
59
75
  type: :runtime
60
76
  prerelease: false
61
- version_requirements: *16375080
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
62
83
  - !ruby/object:Gem::Dependency
63
84
  name: net-ssh-gateway
64
- requirement: &16373280 !ruby/object:Gem::Requirement
85
+ requirement: !ruby/object:Gem::Requirement
65
86
  none: false
66
87
  requirements:
67
88
  - - ! '>='
@@ -69,10 +90,15 @@ dependencies:
69
90
  version: '0'
70
91
  type: :runtime
71
92
  prerelease: false
72
- version_requirements: *16373280
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
73
99
  - !ruby/object:Gem::Dependency
74
100
  name: selenium-webdriver
75
- requirement: &16388200 !ruby/object:Gem::Requirement
101
+ requirement: !ruby/object:Gem::Requirement
76
102
  none: false
77
103
  requirements:
78
104
  - - ! '>='
@@ -80,10 +106,15 @@ dependencies:
80
106
  version: 0.1.2
81
107
  type: :runtime
82
108
  prerelease: false
83
- version_requirements: *16388200
109
+ version_requirements: !ruby/object:Gem::Requirement
110
+ none: false
111
+ requirements:
112
+ - - ! '>='
113
+ - !ruby/object:Gem::Version
114
+ version: 0.1.2
84
115
  - !ruby/object:Gem::Dependency
85
116
  name: childprocess
86
- requirement: &16385280 !ruby/object:Gem::Requirement
117
+ requirement: !ruby/object:Gem::Requirement
87
118
  none: false
88
119
  requirements:
89
120
  - - ! '>='
@@ -91,10 +122,15 @@ dependencies:
91
122
  version: 0.1.6
92
123
  type: :runtime
93
124
  prerelease: false
94
- version_requirements: *16385280
125
+ version_requirements: !ruby/object:Gem::Requirement
126
+ none: false
127
+ requirements:
128
+ - - ! '>='
129
+ - !ruby/object:Gem::Version
130
+ version: 0.1.6
95
131
  - !ruby/object:Gem::Dependency
96
132
  name: json
97
- requirement: &16382900 !ruby/object:Gem::Requirement
133
+ requirement: !ruby/object:Gem::Requirement
98
134
  none: false
99
135
  requirements:
100
136
  - - ! '>='
@@ -102,10 +138,15 @@ dependencies:
102
138
  version: 1.2.0
103
139
  type: :runtime
104
140
  prerelease: false
105
- version_requirements: *16382900
141
+ version_requirements: !ruby/object:Gem::Requirement
142
+ none: false
143
+ requirements:
144
+ - - ! '>='
145
+ - !ruby/object:Gem::Version
146
+ version: 1.2.0
106
147
  - !ruby/object:Gem::Dependency
107
148
  name: cmdparse
108
- requirement: &16381280 !ruby/object:Gem::Requirement
149
+ requirement: !ruby/object:Gem::Requirement
109
150
  none: false
110
151
  requirements:
111
152
  - - ! '>='
@@ -113,10 +154,15 @@ dependencies:
113
154
  version: 2.0.2
114
155
  type: :runtime
115
156
  prerelease: false
116
- version_requirements: *16381280
157
+ version_requirements: !ruby/object:Gem::Requirement
158
+ none: false
159
+ requirements:
160
+ - - ! '>='
161
+ - !ruby/object:Gem::Version
162
+ version: 2.0.2
117
163
  - !ruby/object:Gem::Dependency
118
164
  name: highline
119
- requirement: &16396360 !ruby/object:Gem::Requirement
165
+ requirement: !ruby/object:Gem::Requirement
120
166
  none: false
121
167
  requirements:
122
168
  - - ! '>='
@@ -124,7 +170,12 @@ dependencies:
124
170
  version: 1.5.0
125
171
  type: :runtime
126
172
  prerelease: false
127
- version_requirements: *16396360
173
+ version_requirements: !ruby/object:Gem::Requirement
174
+ none: false
175
+ requirements:
176
+ - - ! '>='
177
+ - !ruby/object:Gem::Version
178
+ version: 1.5.0
128
179
  description: A Ruby helper for running tests in Sauce OnDemand, Sauce Labs' browsers
129
180
  in the cloud service
130
181
  email: help@saucelabs.com
@@ -133,38 +184,10 @@ executables:
133
184
  extensions: []
134
185
  extra_rdoc_files: []
135
186
  files:
136
- - .document
137
- - .gitignore
138
- - Gemfile
139
- - LICENSE
140
- - README.markdown
141
- - Rakefile
142
- - bin/sauce
143
- - gemfiles/rails2.gemfile
144
- - gemfiles/rails2.gemfile.lock
145
- - gemfiles/rails3.gemfile
146
- - gemfiles/rails3.gemfile.lock
147
- - gems/sauce-cucumber/.gitignore
148
- - gems/sauce-cucumber/README.md
149
- - gems/sauce-cucumber/Rakefile
150
- - gems/sauce-cucumber/lib/sauce/cucumber.rb
151
- - gems/sauce-cucumber/sauce-cucumber.gemspec
152
- - gems/sauce-jasmine/.gitignore
153
- - gems/sauce-jasmine/README.md
154
- - gems/sauce-jasmine/Rakefile
155
- - gems/sauce-jasmine/lib/sauce/jasmine.rb
156
- - gems/sauce-jasmine/lib/sauce/jasmine/rake.rb
157
- - gems/sauce-jasmine/lib/sauce/jasmine/runner.rb
158
- - gems/sauce-jasmine/sauce-jasmine.gemspec
159
- - generators/sauce/sauce_generator.rb
160
- - generators/sauce/templates/sauce.rake
161
187
  - lib/generators/sauce/install/install_generator.rb
162
- - lib/generators/sauce/install/templates/sauce.rake
163
- - lib/sauce.rb
164
188
  - lib/sauce/capybara.rb
165
189
  - lib/sauce/client.rb
166
190
  - lib/sauce/config.rb
167
- - lib/sauce/connect.rb
168
191
  - lib/sauce/heroku.rb
169
192
  - lib/sauce/integrations.rb
170
193
  - lib/sauce/job.rb
@@ -172,7 +195,7 @@ files:
172
195
  - lib/sauce/selenium.rb
173
196
  - lib/sauce/utilities.rb
174
197
  - lib/sauce/version.rb
175
- - sauce.gemspec
198
+ - lib/sauce.rb
176
199
  - spec/cucumber_helper.rb
177
200
  - spec/integration/connect_integration_spec.rb
178
201
  - spec/sauce/capybara_spec.rb
@@ -181,8 +204,8 @@ files:
181
204
  - spec/sauce/jasmine_spec.rb
182
205
  - spec/sauce/selenium_spec.rb
183
206
  - spec/spec_helper.rb
184
- - support/Sauce-Connect.jar
185
- homepage: http://github.com/saucelabs/sauce_ruby
207
+ - bin/sauce
208
+ homepage: http://github.com/sauce-labs/sauce_ruby
186
209
  licenses: []
187
210
  post_install_message:
188
211
  rdoc_options: []
@@ -194,22 +217,24 @@ required_ruby_version: !ruby/object:Gem::Requirement
194
217
  - - ! '>='
195
218
  - !ruby/object:Gem::Version
196
219
  version: '0'
197
- segments:
198
- - 0
199
- hash: 669678211782537327
200
220
  required_rubygems_version: !ruby/object:Gem::Requirement
201
221
  none: false
202
222
  requirements:
203
223
  - - ! '>='
204
224
  - !ruby/object:Gem::Version
205
225
  version: '0'
206
- segments:
207
- - 0
208
- hash: 669678211782537327
209
226
  requirements: []
210
227
  rubyforge_project:
211
- rubygems_version: 1.8.10
228
+ rubygems_version: 1.8.23
212
229
  signing_key:
213
230
  specification_version: 3
214
231
  summary: A Ruby helper for running tests in Sauce OnDemand
215
- test_files: []
232
+ test_files:
233
+ - spec/cucumber_helper.rb
234
+ - spec/integration/connect_integration_spec.rb
235
+ - spec/sauce/capybara_spec.rb
236
+ - spec/sauce/config_spec.rb
237
+ - spec/sauce/cucumber_spec.rb
238
+ - spec/sauce/jasmine_spec.rb
239
+ - spec/sauce/selenium_spec.rb
240
+ - spec/spec_helper.rb