cfoundry 4.3.8 → 4.3.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,10 +30,12 @@ module CFoundry::V2
30
30
 
31
31
  response = put("v2", "apps", guid, "bits",
32
32
  :payload => payload,
33
- :params => {"async" => "true"},
34
- :accept => :json)
33
+ :params => {"async" => "true"})
35
34
 
36
- poll_upload_until_finished(response[:metadata][:guid])
35
+ if response.present?
36
+ response_json = JSON.parse(response)
37
+ poll_upload_until_finished(response_json['metadata']['guid'])
38
+ end
37
39
  rescue EOFError
38
40
  retry
39
41
  end
@@ -1,4 +1,4 @@
1
1
  module CFoundry # :nodoc:
2
2
  # CFoundry library version number.
3
- VERSION = "4.3.8".freeze
3
+ VERSION = "4.3.9".freeze
4
4
  end
@@ -249,21 +249,52 @@ describe CFoundry::V2::Base do
249
249
  let(:fake_zipfile) { File.new("#{SPEC_ROOT}/fixtures/empty_file") }
250
250
  let(:upload_response) { %Q({"metadata":{"guid":"#{job_guid}"}}) }
251
251
 
252
- before do
253
- base.should_receive(:poll_upload_until_finished).with(job_guid)
252
+ def stub_upload
253
+ stub_request(:put, "https://api.example.com/v2/apps/#{guid}/bits?async=true"
254
+ ).to_return(
255
+ :body => upload_response
256
+ )
257
+ end
258
+
259
+ def stub_poll
260
+ base.stub(:poll_upload_until_finished)
254
261
  end
255
262
 
256
263
  it "makes a PUT request to the app bits endpoint with the correct payload" do
257
- stub = stub_request(:put, "https://api.example.com/v2/apps/#{guid}/bits?async=true"
258
- ).to_return(
259
- :body => upload_response
260
- )
264
+ upload_stub = stub_upload
265
+ stub_poll
261
266
  base.upload_app(guid, fake_zipfile)
262
- expect(stub).to have_been_requested
267
+ expect(upload_stub).to have_been_requested
268
+ end
269
+
270
+ context "when async is supported" do
271
+ it "polls the job until finished" do
272
+ stub_upload
273
+ status_stub = stub_request(:get, "https://api.example.com/v2/jobs/#{job_guid}"
274
+ ).to_return(
275
+ {:body => {:entity => {:status => 'queued'}}.to_json},
276
+ {:body => {:entity => {:status => 'finished'}}.to_json}
277
+ )
278
+
279
+ base.upload_app(guid, fake_zipfile)
280
+ expect(status_stub).to have_been_requested.twice
281
+ end
282
+ end
283
+
284
+ context "when async is not supported" do
285
+ let(:upload_response) { "" }
286
+
287
+ it "does not explode" do
288
+ stub_upload
289
+ expect {
290
+ base.upload_app(guid, fake_zipfile)
291
+ }.not_to raise_exception
292
+ end
263
293
  end
264
294
 
265
295
  context "when there is no file to upload" do
266
296
  it "does not include 'application' in the request hash" do
297
+ stub_poll
267
298
  stub =
268
299
  stub_request(
269
300
  :put,
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfoundry
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.8
4
+ version: 4.3.9
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Cloud Foundry Team
@@ -9,11 +10,12 @@ authors:
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2013-09-18 00:00:00.000000000 Z
13
+ date: 2013-09-23 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: activemodel
16
17
  requirement: !ruby/object:Gem::Requirement
18
+ none: false
17
19
  requirements:
18
20
  - - <
19
21
  - !ruby/object:Gem::Version
@@ -24,6 +26,7 @@ dependencies:
24
26
  type: :runtime
25
27
  prerelease: false
26
28
  version_requirements: !ruby/object:Gem::Requirement
29
+ none: false
27
30
  requirements:
28
31
  - - <
29
32
  - !ruby/object:Gem::Version
@@ -34,6 +37,7 @@ dependencies:
34
37
  - !ruby/object:Gem::Dependency
35
38
  name: cf-uaa-lib
36
39
  requirement: !ruby/object:Gem::Requirement
40
+ none: false
37
41
  requirements:
38
42
  - - ~>
39
43
  - !ruby/object:Gem::Version
@@ -41,6 +45,7 @@ dependencies:
41
45
  type: :runtime
42
46
  prerelease: false
43
47
  version_requirements: !ruby/object:Gem::Requirement
48
+ none: false
44
49
  requirements:
45
50
  - - ~>
46
51
  - !ruby/object:Gem::Version
@@ -48,6 +53,7 @@ dependencies:
48
53
  - !ruby/object:Gem::Dependency
49
54
  name: multi_json
50
55
  requirement: !ruby/object:Gem::Requirement
56
+ none: false
51
57
  requirements:
52
58
  - - ~>
53
59
  - !ruby/object:Gem::Version
@@ -55,6 +61,7 @@ dependencies:
55
61
  type: :runtime
56
62
  prerelease: false
57
63
  version_requirements: !ruby/object:Gem::Requirement
64
+ none: false
58
65
  requirements:
59
66
  - - ~>
60
67
  - !ruby/object:Gem::Version
@@ -62,6 +69,7 @@ dependencies:
62
69
  - !ruby/object:Gem::Dependency
63
70
  name: multipart-post
64
71
  requirement: !ruby/object:Gem::Requirement
72
+ none: false
65
73
  requirements:
66
74
  - - ~>
67
75
  - !ruby/object:Gem::Version
@@ -69,6 +77,7 @@ dependencies:
69
77
  type: :runtime
70
78
  prerelease: false
71
79
  version_requirements: !ruby/object:Gem::Requirement
80
+ none: false
72
81
  requirements:
73
82
  - - ~>
74
83
  - !ruby/object:Gem::Version
@@ -76,6 +85,7 @@ dependencies:
76
85
  - !ruby/object:Gem::Dependency
77
86
  name: rubyzip
78
87
  requirement: !ruby/object:Gem::Requirement
88
+ none: false
79
89
  requirements:
80
90
  - - ~>
81
91
  - !ruby/object:Gem::Version
@@ -83,6 +93,7 @@ dependencies:
83
93
  type: :runtime
84
94
  prerelease: false
85
95
  version_requirements: !ruby/object:Gem::Requirement
96
+ none: false
86
97
  requirements:
87
98
  - - ~>
88
99
  - !ruby/object:Gem::Version
@@ -90,6 +101,7 @@ dependencies:
90
101
  - !ruby/object:Gem::Dependency
91
102
  name: anchorman
92
103
  requirement: !ruby/object:Gem::Requirement
104
+ none: false
93
105
  requirements:
94
106
  - - ! '>='
95
107
  - !ruby/object:Gem::Version
@@ -97,6 +109,7 @@ dependencies:
97
109
  type: :development
98
110
  prerelease: false
99
111
  version_requirements: !ruby/object:Gem::Requirement
112
+ none: false
100
113
  requirements:
101
114
  - - ! '>='
102
115
  - !ruby/object:Gem::Version
@@ -104,6 +117,7 @@ dependencies:
104
117
  - !ruby/object:Gem::Dependency
105
118
  name: factory_girl
106
119
  requirement: !ruby/object:Gem::Requirement
120
+ none: false
107
121
  requirements:
108
122
  - - ! '>='
109
123
  - !ruby/object:Gem::Version
@@ -111,6 +125,7 @@ dependencies:
111
125
  type: :development
112
126
  prerelease: false
113
127
  version_requirements: !ruby/object:Gem::Requirement
128
+ none: false
114
129
  requirements:
115
130
  - - ! '>='
116
131
  - !ruby/object:Gem::Version
@@ -118,6 +133,7 @@ dependencies:
118
133
  - !ruby/object:Gem::Dependency
119
134
  name: gem-release
120
135
  requirement: !ruby/object:Gem::Requirement
136
+ none: false
121
137
  requirements:
122
138
  - - ! '>='
123
139
  - !ruby/object:Gem::Version
@@ -125,6 +141,7 @@ dependencies:
125
141
  type: :development
126
142
  prerelease: false
127
143
  version_requirements: !ruby/object:Gem::Requirement
144
+ none: false
128
145
  requirements:
129
146
  - - ! '>='
130
147
  - !ruby/object:Gem::Version
@@ -132,6 +149,7 @@ dependencies:
132
149
  - !ruby/object:Gem::Dependency
133
150
  name: json_pure
134
151
  requirement: !ruby/object:Gem::Requirement
152
+ none: false
135
153
  requirements:
136
154
  - - ~>
137
155
  - !ruby/object:Gem::Version
@@ -139,6 +157,7 @@ dependencies:
139
157
  type: :development
140
158
  prerelease: false
141
159
  version_requirements: !ruby/object:Gem::Requirement
160
+ none: false
142
161
  requirements:
143
162
  - - ~>
144
163
  - !ruby/object:Gem::Version
@@ -146,6 +165,7 @@ dependencies:
146
165
  - !ruby/object:Gem::Dependency
147
166
  name: rake
148
167
  requirement: !ruby/object:Gem::Requirement
168
+ none: false
149
169
  requirements:
150
170
  - - ! '>='
151
171
  - !ruby/object:Gem::Version
@@ -153,6 +173,7 @@ dependencies:
153
173
  type: :development
154
174
  prerelease: false
155
175
  version_requirements: !ruby/object:Gem::Requirement
176
+ none: false
156
177
  requirements:
157
178
  - - ! '>='
158
179
  - !ruby/object:Gem::Version
@@ -160,6 +181,7 @@ dependencies:
160
181
  - !ruby/object:Gem::Dependency
161
182
  name: rspec
162
183
  requirement: !ruby/object:Gem::Requirement
184
+ none: false
163
185
  requirements:
164
186
  - - ~>
165
187
  - !ruby/object:Gem::Version
@@ -167,6 +189,7 @@ dependencies:
167
189
  type: :development
168
190
  prerelease: false
169
191
  version_requirements: !ruby/object:Gem::Requirement
192
+ none: false
170
193
  requirements:
171
194
  - - ~>
172
195
  - !ruby/object:Gem::Version
@@ -174,6 +197,7 @@ dependencies:
174
197
  - !ruby/object:Gem::Dependency
175
198
  name: shoulda-matchers
176
199
  requirement: !ruby/object:Gem::Requirement
200
+ none: false
177
201
  requirements:
178
202
  - - ~>
179
203
  - !ruby/object:Gem::Version
@@ -181,6 +205,7 @@ dependencies:
181
205
  type: :development
182
206
  prerelease: false
183
207
  version_requirements: !ruby/object:Gem::Requirement
208
+ none: false
184
209
  requirements:
185
210
  - - ~>
186
211
  - !ruby/object:Gem::Version
@@ -188,6 +213,7 @@ dependencies:
188
213
  - !ruby/object:Gem::Dependency
189
214
  name: timecop
190
215
  requirement: !ruby/object:Gem::Requirement
216
+ none: false
191
217
  requirements:
192
218
  - - ~>
193
219
  - !ruby/object:Gem::Version
@@ -195,6 +221,7 @@ dependencies:
195
221
  type: :development
196
222
  prerelease: false
197
223
  version_requirements: !ruby/object:Gem::Requirement
224
+ none: false
198
225
  requirements:
199
226
  - - ~>
200
227
  - !ruby/object:Gem::Version
@@ -202,6 +229,7 @@ dependencies:
202
229
  - !ruby/object:Gem::Dependency
203
230
  name: webmock
204
231
  requirement: !ruby/object:Gem::Requirement
232
+ none: false
205
233
  requirements:
206
234
  - - ~>
207
235
  - !ruby/object:Gem::Version
@@ -209,6 +237,7 @@ dependencies:
209
237
  type: :development
210
238
  prerelease: false
211
239
  version_requirements: !ruby/object:Gem::Requirement
240
+ none: false
212
241
  requirements:
213
242
  - - ~>
214
243
  - !ruby/object:Gem::Version
@@ -216,6 +245,7 @@ dependencies:
216
245
  - !ruby/object:Gem::Dependency
217
246
  name: putsinator
218
247
  requirement: !ruby/object:Gem::Requirement
248
+ none: false
219
249
  requirements:
220
250
  - - ! '>='
221
251
  - !ruby/object:Gem::Version
@@ -223,6 +253,7 @@ dependencies:
223
253
  type: :development
224
254
  prerelease: false
225
255
  version_requirements: !ruby/object:Gem::Requirement
256
+ none: false
226
257
  requirements:
227
258
  - - ! '>='
228
259
  - !ruby/object:Gem::Version
@@ -419,26 +450,33 @@ files:
419
450
  homepage: http://github.com/cloudfoundry/cfoundry
420
451
  licenses:
421
452
  - Apache 2.0
422
- metadata: {}
423
453
  post_install_message:
424
454
  rdoc_options: []
425
455
  require_paths:
426
456
  - lib
427
457
  required_ruby_version: !ruby/object:Gem::Requirement
458
+ none: false
428
459
  requirements:
429
460
  - - ! '>='
430
461
  - !ruby/object:Gem::Version
431
462
  version: '0'
463
+ segments:
464
+ - 0
465
+ hash: 1033216815776519906
432
466
  required_rubygems_version: !ruby/object:Gem::Requirement
467
+ none: false
433
468
  requirements:
434
469
  - - ! '>='
435
470
  - !ruby/object:Gem::Version
436
471
  version: '0'
472
+ segments:
473
+ - 0
474
+ hash: 1033216815776519906
437
475
  requirements: []
438
476
  rubyforge_project: cfoundry
439
- rubygems_version: 2.0.7
477
+ rubygems_version: 1.8.25
440
478
  signing_key:
441
- specification_version: 4
479
+ specification_version: 3
442
480
  summary: High-level library for working with the Cloud Foundry API.
443
481
  test_files:
444
482
  - spec/cc_api_stub/applications_spec.rb
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZjBmNGMzMDM1NTMwMzVmZGY2MjIyMzA5NDBkZDdiODEzZjY4OGM5MA==
5
- data.tar.gz: !binary |-
6
- NDM3ZWQ1MmJhZjIwN2M2ZjIwZTVkYWM1Zjc4ZmVhYmVhNWZlMzBlMQ==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- ZGI3N2Y4YjY4NTAwZWExMDZlYmQwNGI3YjI4Y2E4NGMxNzIzOWMzZTY5YzQ0
10
- NzQ4NWVhMjg3NDE5MjVkNzNhN2FmNGI0ZWMyNjVmYTE0MThlYzJlYzUxMDA3
11
- ZDA2YjQ1ZGE5YTRlZmRiZmI3ZjY4NmFkZGEzNzMzZGFmYWFiNTM=
12
- data.tar.gz: !binary |-
13
- YzkyN2JmMDRmNWQxZDVhMmZlMzJmNzVlODM0ZTM2NGFkN2FhNzlmNDQ1YmM5
14
- ZTJlMjcxNWZkNmY5YzE1M2IyZmU2M2U3MDYyYWNiN2IxMWU5NjdmZDBmMzYx
15
- MjM5MTFiZGMyODMxM2RhNzgyMTQ0ODQ0ZjMwMDQ4ODM0N2U5MDc=