sauce_whisk 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +17 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +37 -0
- data/Rakefile +10 -0
- data/lib/sauce_whisk/assets.rb +25 -0
- data/lib/sauce_whisk/jobs.rb +112 -0
- data/lib/sauce_whisk/rest_request_builder.rb +29 -0
- data/lib/sauce_whisk/version.rb +3 -0
- data/lib/sauce_whisk.rb +23 -0
- data/sauce_whisk.gemspec +27 -0
- data/spec/fixtures/vcr_cassettes/assets.yml +161478 -0
- data/spec/fixtures/vcr_cassettes/jobs.yml +256 -0
- data/spec/fixtures/vcr_cassettes/no_jobs.yml +0 -0
- data/spec/fixtures/vcr_cassettes/rest_request.yml +0 -0
- data/spec/lib/sauce_whisk/asset_spec.rb +39 -0
- data/spec/lib/sauce_whisk/assets_spec.rb +27 -0
- data/spec/lib/sauce_whisk/job_spec.rb +113 -0
- data/spec/lib/sauce_whisk/jobs_spec.rb +78 -0
- data/spec/lib/sauce_whisk/rest_request_builder_spec.rb +50 -0
- data/spec/lib/sauce_whisk/sauce_whisk_spec.rb +27 -0
- data/spec/spec_helper.rb +25 -0
- data/vendor/psych/lib/psych/class_loader.rb +101 -0
- data/vendor/psych/lib/psych/coder.rb +94 -0
- data/vendor/psych/lib/psych/core_ext.rb +35 -0
- data/vendor/psych/lib/psych/deprecated.rb +85 -0
- data/vendor/psych/lib/psych/exception.rb +13 -0
- data/vendor/psych/lib/psych/handler.rb +249 -0
- data/vendor/psych/lib/psych/handlers/document_stream.rb +22 -0
- data/vendor/psych/lib/psych/handlers/recorder.rb +39 -0
- data/vendor/psych/lib/psych/json/ruby_events.rb +19 -0
- data/vendor/psych/lib/psych/json/stream.rb +16 -0
- data/vendor/psych/lib/psych/json/tree_builder.rb +12 -0
- data/vendor/psych/lib/psych/json/yaml_events.rb +29 -0
- data/vendor/psych/lib/psych/nodes/alias.rb +18 -0
- data/vendor/psych/lib/psych/nodes/document.rb +60 -0
- data/vendor/psych/lib/psych/nodes/mapping.rb +56 -0
- data/vendor/psych/lib/psych/nodes/node.rb +55 -0
- data/vendor/psych/lib/psych/nodes/scalar.rb +67 -0
- data/vendor/psych/lib/psych/nodes/sequence.rb +81 -0
- data/vendor/psych/lib/psych/nodes/stream.rb +37 -0
- data/vendor/psych/lib/psych/nodes.rb +77 -0
- data/vendor/psych/lib/psych/omap.rb +4 -0
- data/vendor/psych/lib/psych/parser.rb +51 -0
- data/vendor/psych/lib/psych/scalar_scanner.rb +149 -0
- data/vendor/psych/lib/psych/set.rb +4 -0
- data/vendor/psych/lib/psych/stream.rb +37 -0
- data/vendor/psych/lib/psych/streaming.rb +27 -0
- data/vendor/psych/lib/psych/syntax_error.rb +21 -0
- data/vendor/psych/lib/psych/tree_builder.rb +96 -0
- data/vendor/psych/lib/psych/visitors/depth_first.rb +26 -0
- data/vendor/psych/lib/psych/visitors/emitter.rb +51 -0
- data/vendor/psych/lib/psych/visitors/json_tree.rb +24 -0
- data/vendor/psych/lib/psych/visitors/to_ruby.rb +372 -0
- data/vendor/psych/lib/psych/visitors/visitor.rb +19 -0
- data/vendor/psych/lib/psych/visitors/yaml_tree.rb +496 -0
- data/vendor/psych/lib/psych/visitors.rb +6 -0
- data/vendor/psych/lib/psych/y.rb +9 -0
- data/vendor/psych/lib/psych.bundle +0 -0
- data/vendor/psych/lib/psych.rb +497 -0
- data/vendor/psych/tmp/x86_64-darwin12.3.0/psych/1.9.3/Makefile +221 -0
- data/vendor/psych/tmp/x86_64-darwin12.3.0/psych/1.9.3/mkmf.log +50 -0
- data/vendor/psych/tmp/x86_64-darwin12.3.0/psych/1.9.3/psych.bundle +0 -0
- data/vendor/psych/tmp/x86_64-darwin12.3.0/psych/1.9.3/psych.o +0 -0
- data/vendor/psych/tmp/x86_64-darwin12.3.0/psych/1.9.3/psych_emitter.o +0 -0
- data/vendor/psych/tmp/x86_64-darwin12.3.0/psych/1.9.3/psych_parser.o +0 -0
- data/vendor/psych/tmp/x86_64-darwin12.3.0/psych/1.9.3/psych_to_ruby.o +0 -0
- data/vendor/psych/tmp/x86_64-darwin12.3.0/psych/1.9.3/psych_yaml_tree.o +0 -0
- metadata +194 -0
@@ -0,0 +1,256 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://<SAUCE_USERNAME>:<SAUCE_ACCESS_KEY>@saucelabs.com/rest/v1/<SAUCE_USERNAME>/jobs
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*; q=0.5, application/xml'
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: !binary |-
|
20
|
+
T0s=
|
21
|
+
headers:
|
22
|
+
!binary "U2VydmVy":
|
23
|
+
- !binary |-
|
24
|
+
bmdpbngvMC43LjYy
|
25
|
+
!binary "RGF0ZQ==":
|
26
|
+
- !binary |-
|
27
|
+
RnJpLCAyNCBNYXkgMjAxMyAwNjowNjozOSBHTVQ=
|
28
|
+
!binary "Q29udGVudC1UeXBl":
|
29
|
+
- !binary |-
|
30
|
+
YXBwbGljYXRpb24vanNvbg==
|
31
|
+
!binary "VHJhbnNmZXItRW5jb2Rpbmc=":
|
32
|
+
- !binary |-
|
33
|
+
Y2h1bmtlZA==
|
34
|
+
!binary "Q29ubmVjdGlvbg==":
|
35
|
+
- !binary |-
|
36
|
+
a2VlcC1hbGl2ZQ==
|
37
|
+
!binary "UHJhZ21h":
|
38
|
+
- !binary |-
|
39
|
+
bm8tY2FjaGU=
|
40
|
+
!binary "Q2FjaGUtQ29udHJvbA==":
|
41
|
+
- !binary |-
|
42
|
+
bm8tY2FjaGU=
|
43
|
+
!binary "WC1GcmFtZS1PcHRpb25z":
|
44
|
+
- !bin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
+
zfXlUK/kleNkyP2pZMCxUb6M7ZNV6vUhsqAQg9Bx9gusmUyzzjxfyuTujw+t
|
100
|
+
ORsFPrf1jxcTHSw+gS8A3uupVZL2twHYuR19zvj/Nn3YaIle5vHWkqTNii+0
|
101
|
+
ml03vbNZx8eKAd+eGSs81qrUk7tIzOyjQfCZnbWIFeLNkyXngnMXUec7WAoa
|
102
|
+
ho+zcBG7/szYcqXwcoI6tyZr4Mw5QRjOgFo+d/gCKc1Bl9DHvjDD2Jvwbh+s
|
103
|
+
mebP2sYpJCN2Q/HPrYMcteGglIEczEdTJ+R1WhE7yVwpA+jkWWzRLK047TNj
|
104
|
+
QtfyQG78kzz2PGoneQnzYE5Pfwfe0rHvJL+B8Up/jYiogzQJAZ8+eN02ps+5
|
105
|
+
B95y0aYKZPbARyabPTP+z/8AL4vSMjARAAA=
|
106
|
+
http_version:
|
107
|
+
recorded_at: Fri, 24 May 2013 06:13:22 GMT
|
108
|
+
- request:
|
109
|
+
method: put
|
110
|
+
uri: https://<SAUCE_USERNAME>:<SAUCE_ACCESS_KEY>@saucelabs.com/rest/v1/<SAUCE_USERNAME>/jobs/bd9c43dd6b5549f1b942d1d581d98cac
|
111
|
+
body:
|
112
|
+
encoding: UTF-8
|
113
|
+
string: ! '{"passed":true}'
|
114
|
+
headers:
|
115
|
+
Accept:
|
116
|
+
- ! '*/*; q=0.5, application/xml'
|
117
|
+
Accept-Encoding:
|
118
|
+
- gzip, deflate
|
119
|
+
Content-Length:
|
120
|
+
- '15'
|
121
|
+
User-Agent:
|
122
|
+
- Ruby
|
123
|
+
response:
|
124
|
+
status:
|
125
|
+
code: 200
|
126
|
+
message: OK
|
127
|
+
headers:
|
128
|
+
Server:
|
129
|
+
- nginx/0.7.62
|
130
|
+
Date:
|
131
|
+
- Fri, 24 May 2013 06:06:41 GMT
|
132
|
+
Content-Type:
|
133
|
+
- application/json
|
134
|
+
Connection:
|
135
|
+
- keep-alive
|
136
|
+
Pragma:
|
137
|
+
- no-cache
|
138
|
+
Cache-Control:
|
139
|
+
- no-cache
|
140
|
+
X-Frame-Options:
|
141
|
+
- DENY
|
142
|
+
Set-Cookie:
|
143
|
+
- csrf_token=1fca4050f7e7f15f6136777dca366a74; expires="Fri, 24-May-2013 06:23:21
|
144
|
+
GMT"; Max-Age=600; Path=/
|
145
|
+
- metrics=afb450bf034cd6510e7200f0070655a0e3d1d6489531f349e57a418491e14accc2f8033e;
|
146
|
+
Path=/
|
147
|
+
Content-Length:
|
148
|
+
- '611'
|
149
|
+
body:
|
150
|
+
encoding: US-ASCII
|
151
|
+
string: ! '{"status": "complete", "commands_not_successful": 2, "name": "Ruby
|
152
|
+
Example for Appium", "video_url": "http://saucelabs.com/jobs/bd9c43dd6b5549f1b942d1d581d98cac/video.flv",
|
153
|
+
"tags": [], "proxied": false, "start_time": 1362100867, "log_url": "http://saucelabs.com/jobs/bd9c43dd6b5549f1b942d1d581d98cac/selenium-server.log",
|
154
|
+
"creation_time": 1362100864, "custom-data": null, "public": null, "browser_version":
|
155
|
+
"6.0", "end_time": 1362101005, "passed": true, "error": null, "owner": "<SAUCE_USERNAME>",
|
156
|
+
"build": null, "os": "Mac 10.8", "id": "bd9c43dd6b5549f1b942d1d581d98cac",
|
157
|
+
"breakpointed": null, "browser": "iphone"}'
|
158
|
+
http_version:
|
159
|
+
recorded_at: Fri, 24 May 2013 06:13:24 GMT
|
160
|
+
- request:
|
161
|
+
method: get
|
162
|
+
uri: https://<SAUCE_USERNAME>:<SAUCE_ACCESS_KEY>@saucelabs.com/rest/v1/<SAUCE_USERNAME>/jobs/bd9c43dd6b5549f1b942d1d581d98cac
|
163
|
+
body:
|
164
|
+
encoding: US-ASCII
|
165
|
+
string: ''
|
166
|
+
headers:
|
167
|
+
Accept:
|
168
|
+
- ! '*/*; q=0.5, application/xml'
|
169
|
+
Accept-Encoding:
|
170
|
+
- gzip, deflate
|
171
|
+
User-Agent:
|
172
|
+
- Ruby
|
173
|
+
response:
|
174
|
+
status:
|
175
|
+
code: 200
|
176
|
+
message: OK
|
177
|
+
headers:
|
178
|
+
Server:
|
179
|
+
- nginx/0.7.62
|
180
|
+
Date:
|
181
|
+
- Fri, 24 May 2013 06:06:42 GMT
|
182
|
+
Content-Type:
|
183
|
+
- application/json
|
184
|
+
Connection:
|
185
|
+
- keep-alive
|
186
|
+
Pragma:
|
187
|
+
- no-cache
|
188
|
+
Cache-Control:
|
189
|
+
- no-cache
|
190
|
+
X-Frame-Options:
|
191
|
+
- DENY
|
192
|
+
Set-Cookie:
|
193
|
+
- csrf_token=b67fdc8286031ffcc397033717951329; expires="Fri, 24-May-2013 06:23:22
|
194
|
+
GMT"; Max-Age=600; Path=/
|
195
|
+
- metrics=38ed2c05075ab9be1c87ef087c892c819423094cb9022f8253ad47ce976bacab1f00e111;
|
196
|
+
Path=/
|
197
|
+
Content-Length:
|
198
|
+
- '611'
|
199
|
+
body:
|
200
|
+
encoding: US-ASCII
|
201
|
+
string: ! '{"status": "complete", "commands_not_successful": 2, "name": "Ruby
|
202
|
+
Example for Appium", "video_url": "http://saucelabs.com/jobs/bd9c43dd6b5549f1b942d1d581d98cac/video.flv",
|
203
|
+
"tags": [], "proxied": false, "start_time": 1362100867, "log_url": "http://saucelabs.com/jobs/bd9c43dd6b5549f1b942d1d581d98cac/selenium-server.log",
|
204
|
+
"creation_time": 1362100864, "custom-data": null, "public": null, "browser_version":
|
205
|
+
"6.0", "end_time": 1362101005, "passed": true, "error": null, "owner": "<SAUCE_USERNAME>",
|
206
|
+
"build": null, "os": "Mac 10.8", "id": "bd9c43dd6b5549f1b942d1d581d98cac",
|
207
|
+
"breakpointed": null, "browser": "iphone"}'
|
208
|
+
http_version:
|
209
|
+
recorded_at: Fri, 24 May 2013 06:13:25 GMT
|
210
|
+
- request:
|
211
|
+
method: get
|
212
|
+
uri: https://<SAUCE_USERNAME>:<SAUCE_ACCESS_KEY>@saucelabs.com/rest/v1/<SAUCE_USERNAME>/jobs/bd9c43dd6b5549f1b942d1d581d98cac/assets
|
213
|
+
body:
|
214
|
+
encoding: US-ASCII
|
215
|
+
string: ''
|
216
|
+
headers:
|
217
|
+
Accept:
|
218
|
+
- ! '*/*; q=0.5, application/xml'
|
219
|
+
Accept-Encoding:
|
220
|
+
- gzip, deflate
|
221
|
+
User-Agent:
|
222
|
+
- Ruby
|
223
|
+
response:
|
224
|
+
status:
|
225
|
+
code: 200
|
226
|
+
message: OK
|
227
|
+
headers:
|
228
|
+
Server:
|
229
|
+
- nginx/0.7.62
|
230
|
+
Date:
|
231
|
+
- Fri, 24 May 2013 06:06:44 GMT
|
232
|
+
Content-Type:
|
233
|
+
- application/json
|
234
|
+
Connection:
|
235
|
+
- keep-alive
|
236
|
+
Pragma:
|
237
|
+
- no-cache
|
238
|
+
Cache-Control:
|
239
|
+
- no-cache
|
240
|
+
X-Frame-Options:
|
241
|
+
- DENY
|
242
|
+
Set-Cookie:
|
243
|
+
- csrf_token=a8dd55863c6e34728839548800f5be3f; expires="Fri, 24-May-2013 06:23:23
|
244
|
+
GMT"; Max-Age=600; Path=/
|
245
|
+
- metrics=a8da11c096f8e70948593274782c462cbf1a5460c0f54e86f6bd4d33af778cb31cc1a5d8;
|
246
|
+
Path=/
|
247
|
+
Content-Length:
|
248
|
+
- '191'
|
249
|
+
body:
|
250
|
+
encoding: US-ASCII
|
251
|
+
string: ! '{"sauce-log": "log.json", "video": "video.flv", "selenium-log": "selenium-server.log",
|
252
|
+
"screenshots": ["0000screenshot.png", "0001screenshot.png", "0002screenshot.png",
|
253
|
+
"0003screenshot.png"]}'
|
254
|
+
http_version:
|
255
|
+
recorded_at: Fri, 24 May 2013 06:13:26 GMT
|
256
|
+
recorded_with: VCR 2.5.0
|
File without changes
|
File without changes
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Asset do
|
4
|
+
|
5
|
+
describe "#initialize" do
|
6
|
+
let(:data) {"DEDEDEDEDED"}
|
7
|
+
let(:name) {"video01.mpg"}
|
8
|
+
let(:job_id) {"c4revevegegerg"}
|
9
|
+
let(:type) {:video}
|
10
|
+
|
11
|
+
before :each do
|
12
|
+
params = {:data => data, :name => name, :type => type, :job_id => job_id}
|
13
|
+
|
14
|
+
@asset = Asset.new params
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should store the name" do
|
18
|
+
@asset.name.should eq name
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should store the data" do
|
22
|
+
@asset.data.should eq data
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should store the type" do
|
26
|
+
@asset.asset_type.should eq type
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should store the job_id" do
|
30
|
+
@asset.job.should eq job_id
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "#type" do
|
35
|
+
it "should default to screenshot" do
|
36
|
+
Asset.new.asset_type.should eq :screenshot
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Assets do
|
4
|
+
let(:auth) {"#{ENV["SAUCE_USERNAME"]}:#{ENV["SAUCE_ACCESS_KEY"]}"}
|
5
|
+
|
6
|
+
describe "#fetch", :vcr => {:cassette_name => "assets"} do
|
7
|
+
let(:job_id) {"bd9c43dd6b5549f1b942d1d581d98cac"}
|
8
|
+
let(:asset_name) {"0000screenshot.png"}
|
9
|
+
|
10
|
+
it "fetches an asset for the requested job" do
|
11
|
+
Assets.fetch job_id, asset_name
|
12
|
+
|
13
|
+
assert_requested :get, "https://#{auth}@saucelabs.com/rest/v1/dylanatsauce/jobs/#{job_id}/assets/#{asset_name}"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "returns an asset" do
|
17
|
+
Assets.fetch(job_id, asset_name).should be_an_instance_of Asset
|
18
|
+
end
|
19
|
+
|
20
|
+
it "initializes the asset properly" do
|
21
|
+
asset = Assets.fetch job_id, asset_name
|
22
|
+
asset.name.should eq asset_name
|
23
|
+
asset.job.should eq job_id
|
24
|
+
asset.asset_type.should eq :screenshot
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Job do
|
4
|
+
let(:job) {Job.new}
|
5
|
+
subject {Job.new}
|
6
|
+
|
7
|
+
it {should respond_to :id}
|
8
|
+
|
9
|
+
context "Initialized" do
|
10
|
+
let(:params) {{
|
11
|
+
"id" => "dsfargeg",
|
12
|
+
"owner" => "Dave",
|
13
|
+
"status" => "Things",
|
14
|
+
"error" => nil,
|
15
|
+
"name" => "Test All The RESTS",
|
16
|
+
"browser" => "firefox",
|
17
|
+
"browser_version" => "18",
|
18
|
+
"os" => "Windows 2008",
|
19
|
+
"creation_time" => Time.now.to_i,
|
20
|
+
"start_time" => Time.now + 4,
|
21
|
+
"end_time" => Time.now + 118,
|
22
|
+
"video_url" => "http://www.notarealplace.com/somewhere/resource",
|
23
|
+
"log_url" => "http://www.underthesea.com/notreally/404",
|
24
|
+
"public" => false,
|
25
|
+
"tags" => ["ruby", "awesome", "restful"],
|
26
|
+
"custom_data" => ""
|
27
|
+
}}
|
28
|
+
|
29
|
+
subject {Job.new(params)}
|
30
|
+
|
31
|
+
it "sets parameters at init" do
|
32
|
+
params.each do |k,v|
|
33
|
+
subject.send(k).should eq v
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it "tracks changes to methods" do
|
38
|
+
subject.name = "ANewName"
|
39
|
+
subject.updated_fields.should include :name
|
40
|
+
|
41
|
+
subject.visibility = true
|
42
|
+
subject.updated_fields.should include :visibility
|
43
|
+
end
|
44
|
+
|
45
|
+
it "does not track unchanged methods" do
|
46
|
+
subject.updated_fields.should_not include :build
|
47
|
+
end
|
48
|
+
|
49
|
+
it "has empty updated_fields for new instances" do
|
50
|
+
new_job = Job.new(params)
|
51
|
+
new_job.updated_fields.should eq []
|
52
|
+
end
|
53
|
+
|
54
|
+
describe "#save" do
|
55
|
+
subject {Job.new(params)}
|
56
|
+
|
57
|
+
context "with changed values" do
|
58
|
+
before(:each) do
|
59
|
+
subject.name = "New_Name"
|
60
|
+
end
|
61
|
+
|
62
|
+
it "calls the save method of the Jobs object" do
|
63
|
+
Jobs.should_receive(:save).with(subject)
|
64
|
+
subject.save
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe "parameters" do
|
70
|
+
it "lets you set only the parameters which are mutable" do
|
71
|
+
[:name, :build, :passed, :tags, :custom_data, :visibility].each do |param|
|
72
|
+
changed_value = "Changed#{param}"
|
73
|
+
subject.send("#{param}=", changed_value)
|
74
|
+
subject.send(param).should eq changed_value
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
it "throws an exception if you try to set one of the fixed attributes" do
|
79
|
+
[:id, :owner, :browser, :browser_version, :os, :error, :creation_time,
|
80
|
+
:start_time, :end_time, :video_url, :log_url
|
81
|
+
].each do |param|
|
82
|
+
expect {
|
83
|
+
subject.send("#{param}=", "TOTALLYDIFFERENT")
|
84
|
+
}.to raise_exception
|
85
|
+
|
86
|
+
subject.send(param).should_not eq "TOTALLYDIFFERENT"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
context "fetched from the API" do
|
93
|
+
subject {Jobs.fetch "bd9c43dd6b5549f1b942d1d581d98cac"}
|
94
|
+
|
95
|
+
describe "#screenshots", :vcr => {:cassette_name => "assets"} do
|
96
|
+
it "contains all the screenshots for that job" do
|
97
|
+
subject.screenshots.length.should be 4
|
98
|
+
end
|
99
|
+
|
100
|
+
it "contains actual screenshots" do
|
101
|
+
subject.screenshots.first.should be_a_kind_of Asset
|
102
|
+
subject.screenshots.first.asset_type.should eq :screenshot
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
describe "#video", :vcr => {:cassette_name => "assets"} do
|
107
|
+
it "should be a video asset" do
|
108
|
+
subject.video.should be_a_kind_of Asset
|
109
|
+
subject.video.asset_type.should eq :video
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Jobs do
|
4
|
+
let(:auth) {"#{ENV["SAUCE_USERNAME"]}:#{ENV["SAUCE_ACCESS_KEY"]}"}
|
5
|
+
describe "#all", :vcr => {:cassette_name => 'jobs'} do
|
6
|
+
|
7
|
+
it "should return an enumerable" do
|
8
|
+
Jobs.all.should be_an Enumerable
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should return a set of jobs" do
|
12
|
+
jobs_found = Jobs.all
|
13
|
+
jobs_found.each {|job| job.should be_a Job}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "##change_status", :vcr => {:cassette_name => "jobs"} do
|
18
|
+
let(:pass_string) {{:passed => true}.to_json}
|
19
|
+
it "exists" do
|
20
|
+
Jobs.respond_to? :change_status
|
21
|
+
end
|
22
|
+
|
23
|
+
it "passes a test status to the REST api" do
|
24
|
+
job_id = "bd9c43dd6b5549f1b942d1d581d98cac"
|
25
|
+
Jobs.change_status job_id, true
|
26
|
+
assert_requested :put, "https://#{auth}@saucelabs.com/rest/v1/dylanatsauce/jobs/#{job_id}", :body => pass_string, :content_type => "application/json"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "##pass_job" do
|
31
|
+
it "Calls the API and passes the given job" do
|
32
|
+
job_id = "rerfreferf"
|
33
|
+
Jobs.should_receive(:change_status).with(job_id, true) {}
|
34
|
+
|
35
|
+
Jobs.pass_job job_id
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "##fail_job" do
|
40
|
+
it "Calls change_status to fail the job" do
|
41
|
+
job_id = "rcercer"
|
42
|
+
Jobs.should_receive(:change_status).with(job_id, false) {}
|
43
|
+
|
44
|
+
Jobs.fail_job job_id
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "##save", :vcr => {:cassette_name => "jobs"} do
|
49
|
+
it "sends a put request" do
|
50
|
+
job_id = "bd9c43dd6b5549f1b942d1d581d98cac"
|
51
|
+
job = Job.new({:id => job_id})
|
52
|
+
Jobs.save (job)
|
53
|
+
assert_requested :put, "https://#{auth}@saucelabs.com/rest/v1/dylanatsauce/jobs/#{job.id}", :body => anything, :content_type => "application/json"
|
54
|
+
end
|
55
|
+
|
56
|
+
it "only sends updated information" do
|
57
|
+
job_id = "bd9c43dd6b5549f1b942d1d581d98cac"
|
58
|
+
job = Job.new({:id => job_id})
|
59
|
+
job.name = "Updated Name"
|
60
|
+
Jobs.save (job)
|
61
|
+
expected_body = {:name => "Updated Name"}.to_json
|
62
|
+
assert_requested :put, "https://#{auth}@saucelabs.com/rest/v1/dylanatsauce/jobs/#{job.id}", :body => expected_body, :content_type => "application/json"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe "##fetch", :vcr => {:cassette_name => "jobs"} do
|
67
|
+
let(:job) {Jobs.fetch("bd9c43dd6b5549f1b942d1d581d98cac")}
|
68
|
+
|
69
|
+
it "contains the list of screenshots for the job" do
|
70
|
+
job.screenshot_urls.should be_a_kind_of Enumerable
|
71
|
+
job.screenshot_urls.length.should_not be 0
|
72
|
+
end
|
73
|
+
|
74
|
+
it "returns a job when a valid one is fetched" do
|
75
|
+
job.should be_an_instance_of Job
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "rest_client"
|
3
|
+
|
4
|
+
describe RestRequestBuilder do
|
5
|
+
let(:dummy_client) {
|
6
|
+
Class.new do
|
7
|
+
extend RestRequestBuilder
|
8
|
+
|
9
|
+
def self.resource
|
10
|
+
"dummy"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
}
|
14
|
+
|
15
|
+
let (:mock_auth) {{
|
16
|
+
:user => ENV["SAUCE_USERNAME"],
|
17
|
+
:password => ENV["SAUCE_ACCESS_KEY"]
|
18
|
+
}}
|
19
|
+
|
20
|
+
describe "#auth_details" do
|
21
|
+
it "should return the env vars" do
|
22
|
+
dummy_client.auth_details.should eq mock_auth
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "#get" do
|
27
|
+
before :all do
|
28
|
+
VCR.insert_cassette 'rest_request', :record => :new_episodes
|
29
|
+
end
|
30
|
+
after :all do
|
31
|
+
VCR.eject_cassette
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should call the base URL with the resource name" do
|
35
|
+
expected_url = "#{SauceWhisk.base_url}/#{dummy_client.resource}"
|
36
|
+
expected_params = {:method => :get, :url => expected_url}.merge mock_auth
|
37
|
+
RestClient::Request.should_receive(:execute).with(expected_params)
|
38
|
+
dummy_client.get
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "#put", :vcr => {:cassette_name => 'jobs'} do
|
43
|
+
it "calls the base URL with the put method" do
|
44
|
+
expected_url = "#{SauceWhisk.base_url}/#{dummy_client.resource}/something"
|
45
|
+
expected_params = {:method => :put, :url => expected_url, :payload => "another_thing", :content_type => "application/json"}.merge mock_auth
|
46
|
+
RestClient::Request.should_receive(:execute).with(expected_params)
|
47
|
+
dummy_client.put "something", "another_thing"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe SauceWhisk do
|
4
|
+
describe "##base_url" do
|
5
|
+
subject {SauceWhisk.base_url}
|
6
|
+
it {should eq "https://saucelabs.com/rest/v1"}
|
7
|
+
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "##username" do
|
11
|
+
subject {SauceWhisk.username}
|
12
|
+
it {should eq ENV["SAUCE_USERNAME"]}
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "##password" do
|
16
|
+
subject {SauceWhisk.password}
|
17
|
+
it {should eq ENV["SAUCE_ACCESS_KEY"]}
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "##pass_job" do
|
21
|
+
it "should call #pass on the jobs object" do
|
22
|
+
job_id = "0418999"
|
23
|
+
Jobs.should_receive(:pass_job).with(job_id) {true}
|
24
|
+
SauceWhisk.pass_job job_id
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require "psych"
|
2
|
+
require "sauce_whisk"
|
3
|
+
require "webmock/rspec"
|
4
|
+
require "vcr"
|
5
|
+
|
6
|
+
puts "PSYCH: #{Psych::VERSION}"
|
7
|
+
|
8
|
+
|
9
|
+
VCR.configure do |config|
|
10
|
+
config.cassette_library_dir = "spec/fixtures/vcr_cassettes"
|
11
|
+
config.hook_into :webmock
|
12
|
+
config.configure_rspec_metadata!
|
13
|
+
config.default_cassette_options = {
|
14
|
+
:erb => true,
|
15
|
+
:record => :new_episodes
|
16
|
+
}
|
17
|
+
config.filter_sensitive_data("<SAUCE_USERNAME>") { ENV["SAUCE_USERNAME"] }
|
18
|
+
config.filter_sensitive_data("<SAUCE_ACCESS_KEY>") { ENV["SAUCE_ACCESS_KEY"] }
|
19
|
+
|
20
|
+
#config.debug_logger = STDOUT
|
21
|
+
end
|
22
|
+
|
23
|
+
RSpec.configure do |config|
|
24
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
25
|
+
end
|