cloudapp 2.0.0.beta.3 → 2.0.0.beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/cloudapp.gemspec +3 -16
- data/lib/cloudapp/drop.rb +9 -4
- data/lib/cloudapp/drop_collection.rb +18 -3
- data/lib/cloudapp/service.rb +31 -9
- data/lib/cloudapp.rb +1 -3
- data/spec/cassettes/account_token.yml +88 -0
- data/spec/cassettes/create_bookmark.yml +75 -198
- data/spec/cassettes/create_bookmark_with_name.yml +76 -209
- data/spec/cassettes/create_bookmark_with_privacy.yml +76 -220
- data/spec/cassettes/list_drops.yml +49 -101
- data/spec/cassettes/list_drops_with_bad_token.yml +25 -37
- data/spec/cassettes/list_drops_with_filter.yml +73 -153
- data/spec/cassettes/list_drops_with_limit.yml +73 -155
- data/spec/cassettes/purge_drops.yml +259 -896
- data/spec/cassettes/setup_drops.yml +318 -666
- data/spec/cassettes/token_for_account.yml +53 -92
- data/spec/cassettes/token_for_account_with_bad_credentials.yml +51 -80
- data/spec/cassettes/upload_file.yml +119 -313
- data/spec/cassettes/upload_file_with_name.yml +121 -327
- data/spec/cassettes/upload_file_with_privacy.yml +120 -338
- data/spec/cassettes/view_drop.yml +26 -54
- data/spec/cloudapp/drop_collection_spec.rb +86 -22
- data/spec/cloudapp/drop_spec.rb +24 -1
- data/spec/cloudapp/service_spec.rb +183 -205
- data/spec/integration_spec.rb +43 -75
- data/spec/support/vcr.rb +1 -1
- metadata +3 -16
- data/lib/cloudapp/account.rb +0 -111
- data/lib/cloudapp/token.rb +0 -27
- data/spec/cassettes/delete_drop.yml +0 -383
- data/spec/cassettes/list_drops_with_href.yml +0 -287
- data/spec/cassettes/list_drops_with_href_and_filter.yml +0 -287
- data/spec/cassettes/list_drops_with_href_and_limit.yml +0 -287
- data/spec/cassettes/list_drops_with_nil_href.yml +0 -139
- data/spec/cassettes/recover_drop.yml +0 -628
- data/spec/cassettes/rename_drop.yml +0 -367
- data/spec/cassettes/trash_drop.yml +0 -478
- data/spec/cassettes/update_drop_bookmark_url.yml +0 -379
- data/spec/cassettes/update_file.yml +0 -573
- data/spec/cloudapp/account_spec.rb +0 -166
- data/spec/cloudapp/token_spec.rb +0 -33
@@ -4,108 +4,118 @@ require 'support/vcr'
|
|
4
4
|
require 'cloudapp/service'
|
5
5
|
|
6
6
|
describe CloudApp::Service do
|
7
|
-
let(:service)
|
8
|
-
let(:token)
|
9
|
-
let(:
|
7
|
+
let(:service) { CloudApp::Service.using_token token }
|
8
|
+
let(:token) { 'abc123' }
|
9
|
+
let(:email) { 'arthur@dent.com' }
|
10
|
+
let(:password) { 'towel' }
|
11
|
+
let(:favicon) {
|
10
12
|
Pathname('../../support/files/favicon.ico').expand_path(__FILE__)
|
11
13
|
}
|
12
14
|
|
13
15
|
after(:all) do
|
14
16
|
VCR.use_cassette('purge_drops') do
|
15
|
-
service.drops(filter: 'all').
|
17
|
+
service.drops(filter: 'all').each do |drop|
|
16
18
|
service.delete_drop(drop.href)
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
21
|
-
describe '
|
22
|
-
subject {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
drop = service.bookmark 'http://getcloudapp.com', name: 'CloudApp'
|
28
|
-
service.trash_drop drop.href
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
it { should be_a(CloudApp::CollectionJson::Representation) }
|
23
|
+
describe '.token_for_account' do
|
24
|
+
subject {
|
25
|
+
VCR.use_cassette('token_for_account') {
|
26
|
+
CloudApp::Service.token_for_account email, password
|
27
|
+
}
|
28
|
+
}
|
33
29
|
|
34
|
-
it '
|
35
|
-
subject.should
|
30
|
+
it 'returns the token' do
|
31
|
+
subject.should be_a(String)
|
32
|
+
subject.should eq(token)
|
36
33
|
end
|
37
34
|
|
38
|
-
context 'with
|
35
|
+
context 'with bad credentials' do
|
36
|
+
let(:password) { 'wrong' }
|
39
37
|
subject {
|
40
|
-
VCR.use_cassette('
|
41
|
-
|
38
|
+
VCR.use_cassette('token_for_account_with_bad_credentials') {
|
39
|
+
CloudApp::Service.token_for_account email, password
|
42
40
|
}
|
43
41
|
}
|
44
42
|
|
45
|
-
it 'returns
|
46
|
-
subject.should
|
43
|
+
it 'returns nothing' do
|
44
|
+
subject.should be_nil
|
47
45
|
end
|
48
46
|
end
|
47
|
+
end
|
49
48
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
}
|
49
|
+
describe '#account_token' do
|
50
|
+
subject {
|
51
|
+
VCR.use_cassette('account_token') {
|
52
|
+
CloudApp::Service.new.account_token email, password
|
55
53
|
}
|
54
|
+
}
|
56
55
|
|
57
|
-
|
58
|
-
|
59
|
-
|
56
|
+
it { should be_a(CloudApp::CollectionJson::Representation) }
|
57
|
+
|
58
|
+
it 'returns a single item' do
|
59
|
+
subject.should have(1).item
|
60
60
|
end
|
61
61
|
|
62
|
-
|
62
|
+
it 'returns the token' do
|
63
|
+
subject.items.first.data.should eq('token' => token)
|
64
|
+
end
|
65
|
+
|
66
|
+
context 'with bad credentials' do
|
67
|
+
let(:password) { 'wrong' }
|
63
68
|
subject {
|
64
|
-
VCR.use_cassette('
|
65
|
-
|
66
|
-
service.drops href: @href
|
69
|
+
VCR.use_cassette('token_for_account_with_bad_credentials') {
|
70
|
+
CloudApp::Service.new.account_token email, password
|
67
71
|
}
|
68
72
|
}
|
69
73
|
|
70
|
-
it
|
71
|
-
|
74
|
+
it { should be_unauthorized }
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
describe '#drops' do
|
79
|
+
subject { VCR.use_cassette('list_drops') { service.drops }}
|
80
|
+
before do
|
81
|
+
VCR.use_cassette('setup_drops') do
|
82
|
+
service.upload favicon
|
83
|
+
service.bookmark 'http://cl.ly', private: false
|
84
|
+
drop = service.bookmark('http://getcloudapp.com', name: 'CloudApp').first
|
85
|
+
service.trash_drop drop.href
|
72
86
|
end
|
73
87
|
end
|
74
88
|
|
75
|
-
|
76
|
-
subject {
|
77
|
-
VCR.use_cassette('list_drops_with_nil_href') {
|
78
|
-
service.drops(href: nil)
|
79
|
-
}
|
80
|
-
}
|
89
|
+
it { should be_a(CloudApp::DropCollection) }
|
81
90
|
|
82
|
-
|
83
|
-
|
84
|
-
end
|
91
|
+
it 'has 2 drops' do
|
92
|
+
subject.should have(2).items
|
85
93
|
end
|
86
94
|
|
87
|
-
context 'with
|
95
|
+
context 'with filter' do
|
88
96
|
subject {
|
89
|
-
VCR.use_cassette('
|
90
|
-
|
91
|
-
service.drops href: @href, filter: 'trash'
|
97
|
+
VCR.use_cassette('list_drops_with_filter') {
|
98
|
+
service.drops filter: 'trash'
|
92
99
|
}
|
93
100
|
}
|
94
101
|
|
95
|
-
it
|
102
|
+
it { should be_a(CloudApp::DropCollection) }
|
103
|
+
|
104
|
+
it 'returns the filtered drops' do
|
96
105
|
subject.should have(1).items
|
97
106
|
end
|
98
107
|
end
|
99
108
|
|
100
|
-
context 'with
|
109
|
+
context 'with limit' do
|
101
110
|
subject {
|
102
|
-
VCR.use_cassette('
|
103
|
-
|
104
|
-
service.drops href: @href, limit: 42
|
111
|
+
VCR.use_cassette('list_drops_with_limit') {
|
112
|
+
service.drops limit: 1
|
105
113
|
}
|
106
114
|
}
|
107
115
|
|
108
|
-
it
|
116
|
+
it { should be_a(CloudApp::DropCollection) }
|
117
|
+
|
118
|
+
it 'limits drops' do
|
109
119
|
subject.should have(1).items
|
110
120
|
end
|
111
121
|
end
|
@@ -118,96 +128,38 @@ describe CloudApp::Service do
|
|
118
128
|
}
|
119
129
|
}
|
120
130
|
|
131
|
+
it { should be_a(CloudApp::DropCollection) }
|
121
132
|
it { should be_unauthorized }
|
122
133
|
end
|
123
134
|
end
|
124
135
|
|
125
|
-
describe '#
|
136
|
+
describe '#drop' do
|
126
137
|
subject {
|
127
138
|
VCR.use_cassette('list_drops') {
|
128
|
-
@href = service.drops.
|
139
|
+
@href = service.drops.first.href
|
129
140
|
}
|
130
|
-
VCR.use_cassette('view_drop') { service.
|
141
|
+
VCR.use_cassette('view_drop') { service.drop(@href) }
|
131
142
|
}
|
132
143
|
|
133
|
-
it { should be_a(CloudApp::
|
144
|
+
it { should be_a(CloudApp::DropCollection) }
|
134
145
|
|
135
146
|
it 'returns a drop' do
|
136
147
|
subject.should have(1).item
|
137
148
|
end
|
138
149
|
end
|
139
150
|
|
140
|
-
describe '#update' do
|
141
|
-
let(:url) { 'http://getcloudapp.com' }
|
142
|
-
let(:name) { 'New Drop Name' }
|
143
|
-
let(:private) { false }
|
144
|
-
subject {
|
145
|
-
VCR.use_cassette('rename_drop') {
|
146
|
-
drop = service.bookmark(url).items.first
|
147
|
-
service.update drop.href, name: name, private: private
|
148
|
-
}
|
149
|
-
}
|
150
|
-
|
151
|
-
it { should be_a(CloudApp::CollectionJson::Representation) }
|
152
|
-
|
153
|
-
it 'returns the updated drop' do
|
154
|
-
subject.should have(1).item
|
155
|
-
end
|
156
|
-
|
157
|
-
it 'updates the name' do
|
158
|
-
subject.items.first.data['name'].should eq(name)
|
159
|
-
end
|
160
|
-
|
161
|
-
it 'updates the privacy' do
|
162
|
-
subject.items.first.data['private'].should eq(private)
|
163
|
-
end
|
164
|
-
|
165
|
-
context 'updating bookmark link' do
|
166
|
-
subject {
|
167
|
-
VCR.use_cassette('update_drop_bookmark_url') {
|
168
|
-
drop = service.bookmark(url).items.first
|
169
|
-
service.update drop.href, url: 'http://example.org'
|
170
|
-
}
|
171
|
-
}
|
172
|
-
|
173
|
-
it { should be_a(CloudApp::CollectionJson::Representation) }
|
174
|
-
|
175
|
-
it 'returns the new drop' do
|
176
|
-
subject.should have(1).item
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
context 'updating file' do
|
181
|
-
let(:options) {{ path: favicon }}
|
182
|
-
subject {
|
183
|
-
VCR.use_cassette('update_file') {
|
184
|
-
drop = service.bookmark(url).items.first
|
185
|
-
service.update drop.href, options
|
186
|
-
}
|
187
|
-
}
|
188
|
-
|
189
|
-
it { should be_a(CloudApp::CollectionJson::Representation) }
|
190
|
-
|
191
|
-
it 'returns the new drop' do
|
192
|
-
subject.should have(1).item
|
193
|
-
end
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
151
|
describe '#bookmark' do
|
198
152
|
let(:url) { 'http://getcloudapp.com' }
|
199
153
|
subject {
|
200
154
|
VCR.use_cassette('create_bookmark') { service.bookmark(url) }
|
201
155
|
}
|
202
156
|
|
203
|
-
it { should be_a(CloudApp::
|
157
|
+
it { should be_a(CloudApp::DropCollection) }
|
204
158
|
|
205
159
|
it 'returns the new drop' do
|
206
160
|
subject.should have(1).item
|
207
161
|
end
|
208
162
|
|
209
|
-
it 'bookmarks the url'
|
210
|
-
|
211
163
|
context 'with a name' do
|
212
164
|
let(:name) { 'New Bookmark' }
|
213
165
|
subject {
|
@@ -217,7 +169,7 @@ describe CloudApp::Service do
|
|
217
169
|
}
|
218
170
|
|
219
171
|
it 'has the given name' do
|
220
|
-
subject.
|
172
|
+
subject.first.data['name'].should eq(name)
|
221
173
|
end
|
222
174
|
end
|
223
175
|
|
@@ -229,7 +181,7 @@ describe CloudApp::Service do
|
|
229
181
|
}
|
230
182
|
|
231
183
|
it 'is public' do
|
232
|
-
subject.
|
184
|
+
subject.first.data['private'].should eq(false)
|
233
185
|
end
|
234
186
|
end
|
235
187
|
end
|
@@ -239,7 +191,7 @@ describe CloudApp::Service do
|
|
239
191
|
VCR.use_cassette('upload_file') { service.upload(favicon) }
|
240
192
|
}
|
241
193
|
|
242
|
-
it { should be_a(CloudApp::
|
194
|
+
it { should be_a(CloudApp::DropCollection) }
|
243
195
|
|
244
196
|
it 'returns the new drop' do
|
245
197
|
subject.should have(1).item
|
@@ -254,7 +206,7 @@ describe CloudApp::Service do
|
|
254
206
|
}
|
255
207
|
|
256
208
|
it 'has the given name' do
|
257
|
-
subject.
|
209
|
+
subject.first.data['name'].should eq(name)
|
258
210
|
end
|
259
211
|
end
|
260
212
|
|
@@ -266,92 +218,118 @@ describe CloudApp::Service do
|
|
266
218
|
}
|
267
219
|
|
268
220
|
it 'is public' do
|
269
|
-
subject.
|
221
|
+
subject.first.data['private'].should eq(false)
|
270
222
|
end
|
271
223
|
end
|
272
224
|
|
273
225
|
describe 'too large file'
|
274
226
|
end
|
275
227
|
|
276
|
-
describe '#token_for_account' do
|
277
|
-
let(:service) { CloudApp::Service.new }
|
278
|
-
let(:email) { 'arthur@dent.com' }
|
279
|
-
let(:password) { 'towel' }
|
280
|
-
subject {
|
281
|
-
VCR.use_cassette('token_for_account') {
|
282
|
-
CloudApp::Service.new.token_for_account email, password
|
283
|
-
}
|
284
|
-
}
|
285
|
-
|
286
|
-
it { should be_a(CloudApp::CollectionJson::Representation) }
|
287
|
-
|
288
|
-
it 'returns a single item' do
|
289
|
-
subject.should have(1).item
|
290
|
-
end
|
291
|
-
|
292
|
-
it 'returns the token' do
|
293
|
-
subject.items.first.data.should eq('token' => token)
|
294
|
-
end
|
295
|
-
|
296
|
-
context 'with bad credentials' do
|
297
|
-
let(:password) { 'wrong' }
|
298
|
-
subject {
|
299
|
-
VCR.use_cassette('token_for_account_with_bad_credentials') {
|
300
|
-
CloudApp::Service.new.token_for_account email, password
|
301
|
-
}
|
302
|
-
}
|
303
|
-
|
304
|
-
it { should be_unauthorized }
|
305
|
-
end
|
306
|
-
end
|
307
|
-
|
308
|
-
describe '#trash_drop' do
|
309
|
-
subject {
|
310
|
-
VCR.use_cassette('trash_drop') {
|
311
|
-
drop = service.bookmark('http://getcloudapp.com').items.first
|
312
|
-
service.trash_drop drop.href
|
313
|
-
}
|
314
|
-
}
|
315
|
-
|
316
|
-
it { should be_a(CloudApp::CollectionJson::Representation) }
|
317
|
-
|
318
|
-
it 'returns the trashed drop' do
|
319
|
-
subject.should have(1).item
|
320
|
-
end
|
321
228
|
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
end
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
229
|
+
# describe '#update' do
|
230
|
+
# let(:url) { 'http://getcloudapp.com' }
|
231
|
+
# let(:name) { 'New Drop Name' }
|
232
|
+
# let(:private) { false }
|
233
|
+
# subject {
|
234
|
+
# VCR.use_cassette('rename_drop') {
|
235
|
+
# drop = service.bookmark(url).items.first
|
236
|
+
# service.update drop.href, name: name, private: private
|
237
|
+
# }
|
238
|
+
# }
|
239
|
+
|
240
|
+
# it { should be_a(CloudApp::CollectionJson::Representation) }
|
241
|
+
|
242
|
+
# it 'returns the updated drop' do
|
243
|
+
# subject.should have(1).item
|
244
|
+
# end
|
245
|
+
|
246
|
+
# it 'updates the name' do
|
247
|
+
# subject.items.first.data['name'].should eq(name)
|
248
|
+
# end
|
249
|
+
|
250
|
+
# it 'updates the privacy' do
|
251
|
+
# subject.items.first.data['private'].should eq(private)
|
252
|
+
# end
|
253
|
+
|
254
|
+
# context 'updating bookmark link' do
|
255
|
+
# subject {
|
256
|
+
# VCR.use_cassette('update_drop_bookmark_url') {
|
257
|
+
# drop = service.bookmark(url).items.first
|
258
|
+
# service.update drop.href, url: 'http://example.org'
|
259
|
+
# }
|
260
|
+
# }
|
261
|
+
|
262
|
+
# it { should be_a(CloudApp::CollectionJson::Representation) }
|
263
|
+
|
264
|
+
# it 'returns the new drop' do
|
265
|
+
# subject.should have(1).item
|
266
|
+
# end
|
267
|
+
# end
|
268
|
+
|
269
|
+
# context 'updating file' do
|
270
|
+
# let(:options) {{ path: favicon }}
|
271
|
+
# subject {
|
272
|
+
# VCR.use_cassette('update_file') {
|
273
|
+
# drop = service.bookmark(url).items.first
|
274
|
+
# service.update drop.href, options
|
275
|
+
# }
|
276
|
+
# }
|
277
|
+
|
278
|
+
# it { should be_a(CloudApp::CollectionJson::Representation) }
|
279
|
+
|
280
|
+
# it 'returns the new drop' do
|
281
|
+
# subject.should have(1).item
|
282
|
+
# end
|
283
|
+
# end
|
284
|
+
# end
|
285
|
+
|
286
|
+
# describe '#trash_drop' do
|
287
|
+
# subject {
|
288
|
+
# VCR.use_cassette('trash_drop') {
|
289
|
+
# drop = service.bookmark('http://getcloudapp.com').items.first
|
290
|
+
# service.trash_drop drop.href
|
291
|
+
# }
|
292
|
+
# }
|
293
|
+
|
294
|
+
# it { should be_a(CloudApp::CollectionJson::Representation) }
|
295
|
+
|
296
|
+
# it 'returns the trashed drop' do
|
297
|
+
# subject.should have(1).item
|
298
|
+
# end
|
299
|
+
|
300
|
+
# it 'trashes the drop' do
|
301
|
+
# subject.items.first.data['trash'].should eq(true)
|
302
|
+
# end
|
303
|
+
# end
|
304
|
+
|
305
|
+
# describe '#recover_drop' do
|
306
|
+
# subject {
|
307
|
+
# VCR.use_cassette('recover_drop') {
|
308
|
+
# drop = service.bookmark('http://getcloudapp.com').items.first
|
309
|
+
# service.trash_drop drop.href
|
310
|
+
# service.recover_drop drop.href
|
311
|
+
# }
|
312
|
+
# }
|
313
|
+
|
314
|
+
# it { should be_a(CloudApp::CollectionJson::Representation) }
|
315
|
+
|
316
|
+
# it 'returns the recovered drop' do
|
317
|
+
# subject.should have(1).item
|
318
|
+
# end
|
319
|
+
|
320
|
+
# it 'recovers the drop' do
|
321
|
+
# subject.items.first.data['trash'].should eq(false)
|
322
|
+
# end
|
323
|
+
# end
|
324
|
+
|
325
|
+
# describe '#delete_drop' do
|
326
|
+
# subject {
|
327
|
+
# VCR.use_cassette('delete_drop') {
|
328
|
+
# drop = service.bookmark('http://getcloudapp.com').items.first
|
329
|
+
# service.delete_drop drop.href
|
330
|
+
# }
|
331
|
+
# }
|
332
|
+
|
333
|
+
# it { should be_authorized }
|
334
|
+
# end
|
357
335
|
end
|
data/spec/integration_spec.rb
CHANGED
@@ -6,95 +6,63 @@ require 'cloudapp'
|
|
6
6
|
describe CloudApp, :integration do
|
7
7
|
let(:path) { Pathname('../support/files/favicon.ico').expand_path(__FILE__) }
|
8
8
|
|
9
|
-
def all_drops(options = {})
|
10
|
-
options = { filter: 'all' }.merge(options)
|
11
|
-
@account.drops(options)
|
12
|
-
end
|
13
|
-
|
14
|
-
def active_drops
|
15
|
-
@account.drops(filter: 'active')
|
16
|
-
end
|
17
|
-
|
18
|
-
def trashed_drops
|
19
|
-
@account.drops(filter: 'trash')
|
20
|
-
end
|
21
|
-
|
22
|
-
def create_bookmark(url, options = {})
|
23
|
-
@account.bookmark(url, options).first
|
24
|
-
end
|
25
|
-
|
26
|
-
def create_upload(path, options = {})
|
27
|
-
@account.upload(path, options).first
|
28
|
-
end
|
29
|
-
|
30
|
-
def drop_details(drop)
|
31
|
-
@account.drop_at(drop.href).first
|
32
|
-
end
|
33
|
-
|
34
|
-
def recover_drop(drop)
|
35
|
-
@account.recover_drop(drop.href).first
|
36
|
-
end
|
37
|
-
|
38
|
-
def trash_drop(drop)
|
39
|
-
@account.trash_drop(drop.href).first
|
40
|
-
end
|
41
|
-
|
42
|
-
def delete_drop(drop)
|
43
|
-
@account.delete_drop(drop.href)
|
44
|
-
end
|
45
|
-
|
46
|
-
|
47
9
|
it 'integrates with the API' do
|
48
|
-
token = CloudApp::
|
49
|
-
token.
|
50
|
-
|
51
|
-
@account = CloudApp::Account.using_token token
|
52
|
-
drops = all_drops
|
53
|
-
unless all_drops.empty?
|
54
|
-
drops.each do |drop| delete_drop(drop) end
|
55
|
-
end
|
10
|
+
token = CloudApp::Service.token_for_account 'arthur@dent.com', 'towel'
|
11
|
+
token.should =~ /\w+/
|
56
12
|
|
57
|
-
|
13
|
+
service = CloudApp::Service.using_token token
|
14
|
+
service.drops(filter: 'all').each(&:delete)
|
15
|
+
service.drops(filter: 'all').should be_empty
|
58
16
|
|
59
|
-
bookmark =
|
60
|
-
file =
|
61
|
-
public_drop =
|
17
|
+
bookmark = service.bookmark('http://getcloudapp.com', name: 'CloudApp').first
|
18
|
+
file = service.upload(path).first
|
19
|
+
public_drop = service.bookmark('http://getcloudapp.com', private: false).first
|
62
20
|
|
63
|
-
|
21
|
+
service.drops(filter: 'all').should have(3).items
|
64
22
|
|
65
|
-
bookmark_details =
|
23
|
+
bookmark_details = service.drop(bookmark.href).first
|
66
24
|
bookmark_details.name .should eq('CloudApp')
|
67
25
|
bookmark_details.private.should eq(true)
|
68
26
|
|
69
|
-
|
70
|
-
|
27
|
+
file_details = service.drop(file.href).first
|
28
|
+
file_details.name .should eq('favicon.ico')
|
29
|
+
file_details.private.should eq(true)
|
30
|
+
|
31
|
+
public_drop_details = service.drop(public_drop.href).first
|
32
|
+
public_drop_details.name .should eq('http://getcloudapp.com')
|
33
|
+
public_drop_details.private.should eq(false)
|
34
|
+
|
35
|
+
bookmark.trash
|
36
|
+
file .trash
|
37
|
+
service.drops(filter: 'all') .should have(3).items
|
38
|
+
service.drops(filter: 'active').should have(1).item
|
39
|
+
service.drops(filter: 'trash') .should have(2).items
|
71
40
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
trashed_drops.should have(2).items
|
41
|
+
bookmark.recover
|
42
|
+
service.drops(filter: 'all') .should have(3).items
|
43
|
+
service.drops(filter: 'active').should have(2).item
|
44
|
+
service.drops(filter: 'trash') .should have(1).items
|
77
45
|
|
78
|
-
|
79
|
-
|
80
|
-
active_drops .should have(2).items
|
81
|
-
trashed_drops.should have(1).items
|
46
|
+
page1 = service.drops(filter: 'all', limit: 1)
|
47
|
+
page1.should have(1).item
|
82
48
|
|
83
|
-
|
84
|
-
|
49
|
+
page2 = page1.follow 'next'
|
50
|
+
page2.should have(1).item
|
85
51
|
|
86
|
-
|
87
|
-
|
52
|
+
page3 = page2.follow 'next'
|
53
|
+
page3.should have(1).item
|
54
|
+
page3.has_link?('next').should eq(false)
|
88
55
|
|
89
|
-
|
90
|
-
|
91
|
-
next_page.should have(1).item
|
92
|
-
next_page.link('next') { nil }.should be_nil
|
56
|
+
page2 = page3.follow 'previous'
|
57
|
+
page2.should have(1).item
|
93
58
|
|
94
|
-
|
95
|
-
|
96
|
-
|
59
|
+
page1 = page2.follow 'previous'
|
60
|
+
page1.should have(1).item
|
61
|
+
page1.has_link?('previous').should eq(false)
|
97
62
|
|
98
|
-
|
63
|
+
bookmark .delete
|
64
|
+
file .delete
|
65
|
+
public_drop.delete
|
66
|
+
service.drops(filter: 'all').should be_empty
|
99
67
|
end
|
100
68
|
end
|
data/spec/support/vcr.rb
CHANGED
@@ -2,7 +2,7 @@ require 'vcr'
|
|
2
2
|
|
3
3
|
VCR.configure do |vcr|
|
4
4
|
vcr.cassette_library_dir = 'spec/cassettes'
|
5
|
-
vcr.default_cassette_options = { record: :
|
5
|
+
vcr.default_cassette_options = { record: :once,
|
6
6
|
match_requests_on: [ :method, :uri, :body ]}
|
7
7
|
vcr.hook_into :webmock
|
8
8
|
vcr.configure_rspec_metadata!
|