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
@@ -1,166 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
require 'cloudapp/account'
|
4
|
-
|
5
|
-
describe CloudApp::Account do
|
6
|
-
let(:args) { stub :args }
|
7
|
-
let(:token) { 'token' }
|
8
|
-
let(:service) { stub :service, :token= => nil }
|
9
|
-
let(:service_source) { -> { service }}
|
10
|
-
let(:drop_collection) { stub :drop_collection }
|
11
|
-
before do
|
12
|
-
stub_class 'CloudApp::DropCollection'
|
13
|
-
CloudApp::Account.service_source = service_source
|
14
|
-
CloudApp::DropCollection.stub new: drop_collection
|
15
|
-
end
|
16
|
-
|
17
|
-
after do
|
18
|
-
CloudApp::Account.service_source = nil
|
19
|
-
if CloudApp::DropCollection.ancestors.include? Stubbed
|
20
|
-
CloudApp.send :remove_const, :DropCollection
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe '.using_token' do
|
25
|
-
it 'constructs and returns a new Account' do
|
26
|
-
CloudApp::Account.should_receive(:new).with(token)
|
27
|
-
CloudApp::Account.using_token(token)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe '#drops' do
|
32
|
-
let(:drops) {[ stub(:drop) ]}
|
33
|
-
subject { CloudApp::Account.new(token).drops(args) }
|
34
|
-
before do service.stub(drops: drops) end
|
35
|
-
|
36
|
-
it { should eq(drop_collection) }
|
37
|
-
|
38
|
-
it 'delegates to the drop service' do
|
39
|
-
service.should_receive(:drops).with(args)
|
40
|
-
subject
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'creates a drop collection' do
|
44
|
-
CloudApp::DropCollection.should_receive(:new).with(drops)
|
45
|
-
subject
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
describe '#drop_at' do
|
50
|
-
let(:drop) { stub :drop }
|
51
|
-
subject { CloudApp::Account.new(token).drop_at(args) }
|
52
|
-
before do service.stub(drop_at: drop) end
|
53
|
-
|
54
|
-
it { should eq(drop_collection) }
|
55
|
-
|
56
|
-
it 'delegates to the drop service' do
|
57
|
-
service.should_receive(:drop_at).with(args)
|
58
|
-
subject
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'creates a drop collection' do
|
62
|
-
CloudApp::DropCollection.should_receive(:new).with(drop)
|
63
|
-
subject
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
describe '#bookmark' do
|
68
|
-
let(:drop) { stub :drop }
|
69
|
-
subject { CloudApp::Account.new(token).bookmark(args) }
|
70
|
-
before do service.stub(bookmark: drop) end
|
71
|
-
|
72
|
-
it { should eq(drop_collection) }
|
73
|
-
|
74
|
-
it 'delegates to the service' do
|
75
|
-
service.should_receive(:bookmark).with(args)
|
76
|
-
subject
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'creates a drop collection' do
|
80
|
-
CloudApp::DropCollection.should_receive(:new).with(drop)
|
81
|
-
subject
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
describe '#upload' do
|
86
|
-
let(:drop) { stub :drop }
|
87
|
-
subject { CloudApp::Account.new(token).upload(args) }
|
88
|
-
before do service.stub(upload: drop) end
|
89
|
-
|
90
|
-
it { should eq(drop_collection) }
|
91
|
-
|
92
|
-
it 'delegates to the service' do
|
93
|
-
service.should_receive(:upload).with(args)
|
94
|
-
subject
|
95
|
-
end
|
96
|
-
|
97
|
-
it 'creates a drop collection' do
|
98
|
-
CloudApp::DropCollection.should_receive(:new).with(drop)
|
99
|
-
subject
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
describe '#update' do
|
104
|
-
let(:drop) { stub :drop }
|
105
|
-
subject { CloudApp::Account.new(token).update(args) }
|
106
|
-
before do service.stub(update: drop) end
|
107
|
-
|
108
|
-
it { should eq(drop_collection) }
|
109
|
-
|
110
|
-
it 'delegates to the drop service' do
|
111
|
-
service.should_receive(:update).with(args)
|
112
|
-
subject
|
113
|
-
end
|
114
|
-
|
115
|
-
it 'creates a drop collection' do
|
116
|
-
CloudApp::DropCollection.should_receive(:new).with(drop)
|
117
|
-
subject
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
describe '#trash_drop' do
|
122
|
-
let(:drop) { stub :drop }
|
123
|
-
subject { CloudApp::Account.new(token).trash_drop(args) }
|
124
|
-
before do service.stub(trash_drop: drop) end
|
125
|
-
|
126
|
-
it { should eq(drop_collection) }
|
127
|
-
|
128
|
-
it 'delegates to the service' do
|
129
|
-
service.should_receive(:trash_drop).with(args)
|
130
|
-
subject
|
131
|
-
end
|
132
|
-
|
133
|
-
it 'creates a drop collection' do
|
134
|
-
CloudApp::DropCollection.should_receive(:new).with(drop)
|
135
|
-
subject
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
describe '#recover_drop' do
|
140
|
-
let(:drop) { stub :drop }
|
141
|
-
subject { CloudApp::Account.new(token).recover_drop(args) }
|
142
|
-
before do service.stub(recover_drop: drop) end
|
143
|
-
|
144
|
-
it { should eq(drop_collection) }
|
145
|
-
|
146
|
-
it 'delegates to the service' do
|
147
|
-
service.should_receive(:recover_drop).with(args)
|
148
|
-
subject
|
149
|
-
end
|
150
|
-
|
151
|
-
it 'creates a drop collection' do
|
152
|
-
CloudApp::DropCollection.should_receive(:new).with(drop)
|
153
|
-
subject
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
describe '#delete_drop' do
|
158
|
-
it 'delegates to the service' do
|
159
|
-
service.should_receive(:delete_drop).with(args)
|
160
|
-
CloudApp::Account.new.delete_drop(args)
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
describe '#download' do
|
165
|
-
end
|
166
|
-
end
|
data/spec/cloudapp/token_spec.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
require 'cloudapp/token'
|
4
|
-
|
5
|
-
describe CloudApp::Token do
|
6
|
-
let(:service_source) { -> { service }}
|
7
|
-
before do CloudApp::Token.service_source = service_source end
|
8
|
-
after do CloudApp::Token.service_source = nil end
|
9
|
-
|
10
|
-
describe '.for_account' do
|
11
|
-
let(:email) { 'arthur@dent.com' }
|
12
|
-
let(:password) { 'towel' }
|
13
|
-
let(:service) { stub :service, token_for_account: representation }
|
14
|
-
let(:representation) { stub :representation, unauthorized?: unauthorized,
|
15
|
-
items: [ item ]}
|
16
|
-
let(:unauthorized) { false }
|
17
|
-
let(:item) { stub :item, data: { 'token' => token }}
|
18
|
-
let(:token) { 'token' }
|
19
|
-
subject { CloudApp::Token.for_account(email, password) }
|
20
|
-
|
21
|
-
it { should eq(token) }
|
22
|
-
|
23
|
-
it 'queries the drop service' do
|
24
|
-
service.should_receive(:token_for_account).with(email, password)
|
25
|
-
subject
|
26
|
-
end
|
27
|
-
|
28
|
-
context 'with bad credentials' do
|
29
|
-
let(:unauthorized) { true }
|
30
|
-
it { should be_nil }
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|