croudia 0.0.2 → 1.0.0

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.
Files changed (66) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/README.md +31 -14
  4. data/Rakefile +11 -11
  5. data/croudia.gemspec +10 -8
  6. data/lib/croudia/api/favorites.rb +43 -0
  7. data/lib/croudia/api/oauth.rb +32 -0
  8. data/lib/croudia/api/statuses.rb +55 -0
  9. data/lib/croudia/api/timelines.rb +57 -0
  10. data/lib/croudia/base.rb +44 -0
  11. data/lib/croudia/client.rb +64 -0
  12. data/lib/croudia/configurable.rb +39 -0
  13. data/lib/croudia/creatable.rb +9 -0
  14. data/lib/croudia/default.rb +63 -0
  15. data/lib/croudia/ext/openssl.rb +19 -0
  16. data/lib/croudia/identity.rb +22 -39
  17. data/lib/croudia/status.rb +26 -0
  18. data/lib/croudia/user.rb +12 -43
  19. data/lib/croudia/version.rb +1 -1
  20. data/lib/croudia.rb +21 -12
  21. data/spec/croudia/api/favorites_spec.rb +35 -0
  22. data/spec/croudia/api/oauth_spec.rb +53 -0
  23. data/spec/croudia/api/statuses_spec.rb +73 -0
  24. data/spec/croudia/api/timelines_spec.rb +93 -0
  25. data/spec/croudia/base_spec.rb +27 -0
  26. data/spec/croudia/client_spec.rb +115 -0
  27. data/spec/croudia/identity_spec.rb +29 -65
  28. data/spec/croudia/status_spec.rb +30 -0
  29. data/spec/croudia/user_spec.rb +30 -43
  30. data/spec/croudia_spec.rb +48 -49
  31. data/spec/fixtures/access_token.json +6 -0
  32. data/spec/fixtures/status.json +1 -0
  33. data/spec/fixtures/timeline.json +1 -0
  34. data/spec/helper.rb +49 -32
  35. metadata +80 -84
  36. data/lib/croudia/api.rb +0 -5
  37. data/lib/croudia/error.rb +0 -5
  38. data/lib/croudia/scraper/friendships.rb +0 -72
  39. data/lib/croudia/scraper/login.rb +0 -42
  40. data/lib/croudia/scraper/parser/users.rb +0 -59
  41. data/lib/croudia/scraper/parser/voices.rb +0 -32
  42. data/lib/croudia/scraper/parser.rb +0 -13
  43. data/lib/croudia/scraper/users.rb +0 -20
  44. data/lib/croudia/scraper/voices.rb +0 -59
  45. data/lib/croudia/scraper.rb +0 -63
  46. data/lib/croudia/voice.rb +0 -21
  47. data/spec/croudia/api_spec.rb +0 -7
  48. data/spec/croudia/error_spec.rb +0 -13
  49. data/spec/croudia/scraper/friendships_spec.rb +0 -115
  50. data/spec/croudia/scraper/login_spec.rb +0 -137
  51. data/spec/croudia/scraper/parser/users_spec.rb +0 -292
  52. data/spec/croudia/scraper/parser/voices_spec.rb +0 -119
  53. data/spec/croudia/scraper/users_spec.rb +0 -78
  54. data/spec/croudia/scraper/voices_spec.rb +0 -178
  55. data/spec/croudia/scraper_spec.rb +0 -120
  56. data/spec/croudia/version_spec.rb +0 -7
  57. data/spec/croudia/voice_spec.rb +0 -16
  58. data/spec/fixtures/follow_request.html +0 -69
  59. data/spec/fixtures/follower_wktk.html +0 -89
  60. data/spec/fixtures/following_wktk.html +0 -89
  61. data/spec/fixtures/user_wktk1.html +0 -72
  62. data/spec/fixtures/user_wktk2.html +0 -75
  63. data/spec/fixtures/user_wktk3.html +0 -83
  64. data/spec/fixtures/voices_reply_list.html +0 -55
  65. data/spec/fixtures/voices_timeline.html +0 -60
  66. data/spec/fixtures/voices_written.html +0 -20
@@ -1,292 +0,0 @@
1
- require 'helper'
2
-
3
- describe Croudia::Scraper::Parser::Users do
4
- describe '#user_page' do
5
- context 'when it does not look like a user page' do
6
- it 'returns nil' do
7
- stub_get('/blank').to_return(:headers => {:content_type => 'text/html'})
8
- Croudia.user('blank').should be_nil
9
- end
10
- end
11
-
12
- context 'when it looks a user page' do
13
- before do
14
- stub_get('/wktk1').to_return(:body => fixture('user_wktk1'), :headers => {:content_type => 'text/html'})
15
- @user1 = Croudia.user('wktk1')
16
- stub_get('/wktk2').to_return(:body => fixture('user_wktk2'), :headers => {:content_type => 'text/html'})
17
- @user2 = Croudia.user('wktk2')
18
- stub_get('/wktk3').to_return(:body => fixture('user_wktk3'), :headers => {:content_type => 'text/html'})
19
- @user3 = Croudia.user('wktk3')
20
- end
21
-
22
- it 'gets username' do
23
- @user1.username.should eq 'wktk'
24
- end
25
-
26
- it 'gets nickname' do
27
- @user1.nickname.should eq 'wktk!'
28
- end
29
-
30
- it 'gets avatar url' do
31
- @user1.avatar.should eq 'https://croudia.com/testimages/download/9423'
32
- end
33
-
34
- it 'gets description' do
35
- @user1.description.should eq 'This is a dummy description for test.'
36
- end
37
-
38
- it 'trims description' do
39
- @user1.description.should_not match /^\s|\s$/
40
- end
41
-
42
- it 'gets voices_count' do
43
- @user1.voices_count.to_i.should eq 3381
44
- end
45
-
46
- it 'converts voices_count into an Integer' do
47
- @user1.voices_count.should be_a Integer
48
- end
49
-
50
- it 'gets following_count' do
51
- @user1.following_count.to_i.should eq 46
52
- end
53
-
54
- it 'converts following_count into an Integer' do
55
- @user1.following_count.should be_a Integer
56
- end
57
-
58
- it 'gets followers_count' do
59
- @user1.followers_count.to_i.should eq 468
60
- end
61
-
62
- it 'converts followers_count into an Integer' do
63
- @user1.followers_count.should be_a Integer
64
- end
65
-
66
- it 'gets album_count' do
67
- @user1.album_count.to_i.should eq 123
68
- end
69
-
70
- it 'converts album_count into an Integer' do
71
- @user1.album_count.should be_a Integer
72
- end
73
-
74
- it 'gets spreadia' do
75
- @user1.spreadia.to_i.should eq 2525
76
- end
77
-
78
- it 'converts spreadia into an Integer' do
79
- @user1.spreadia.should be_a Integer
80
- end
81
-
82
- it 'gets favodia' do
83
- @user1.favodia.to_i.should eq 4321
84
- end
85
-
86
- it 'converts favodia into an Integer' do
87
- @user1.favodia.should be_a Integer
88
- end
89
-
90
- context 'when url is set' do
91
- it 'gets url' do
92
- @user1.url.should eq 'http://wktk.in'
93
- end
94
- end
95
-
96
- context 'when url is not set' do
97
- it 'leaves url nil' do
98
- @user2.url.should be_nil
99
- end
100
- end
101
-
102
- context 'when location is set' do
103
- it 'gets location' do
104
- @user1.location.should eq 'Tokyo, Japan'
105
- end
106
- end
107
-
108
- context 'when location is not set' do
109
- it 'leaves location blank' do
110
- @user2.location.should be_nil
111
- end
112
- end
113
-
114
- context 'when following info included' do
115
- context 'when following' do
116
- it 'makes following true' do
117
- @user2.following.should be_true
118
- end
119
- end
120
-
121
- context 'when not following' do
122
- it 'makes following false' do
123
- @user3.following.should be_false
124
- end
125
- end
126
- end
127
-
128
- context 'when following info not included' do
129
- it 'leaves following nil' do
130
- @user1.following.should be_nil
131
- end
132
- end
133
-
134
- context 'when followed_by info included' do
135
- context 'when followed_by' do
136
- it 'makes followed_by true' do
137
- @user2.followed_by.should be_true
138
- end
139
- end
140
-
141
- context 'when not followed_by' do
142
- it 'makes followed_by false' do
143
- @user3.followed_by.should be_false
144
- end
145
- end
146
- end
147
-
148
- context 'when followed_by info not included' do
149
- it 'leaves followed_by nil' do
150
- @user1.followed_by.should be_nil
151
- end
152
- end
153
- end
154
- end
155
-
156
- describe '#user_list' do
157
- context 'when following list provided' do
158
- before do
159
- stub_get('/follows/following/wktk').to_return(:body => fixture('following_wktk'), :headers => {:content_type => 'text/html'})
160
- @following = Croudia::Scraper.new.following('wktk')
161
- end
162
-
163
- it 'gets all users in the page' do
164
- @following.size.should eq 3
165
- end
166
-
167
- it 'gets username' do
168
- @following[0].username.should eq 'following1'
169
- end
170
-
171
- it 'gets nickname' do
172
- @following[0].nickname.should eq 'following 1'
173
- end
174
-
175
- it 'gets avatar url' do
176
- @following[0].avatar.should eq Croudia.endpoint + '/avatar1'
177
- end
178
-
179
- it 'gets description' do
180
- @following[0].description.should eq 'Description 1'
181
- end
182
-
183
- it 'trims description' do
184
- @following[0].description.should_not match /^\s|\s$/
185
- end
186
-
187
- context 'when following info provided' do
188
- context 'when following' do
189
- it 'sets following true' do
190
- @following[0].following.should be_true
191
- end
192
- end
193
-
194
- context 'when not following' do
195
- it 'sets following false' do
196
- @following[1].following.should be_false
197
- end
198
- end
199
- end
200
-
201
- context 'when following info not provided' do
202
- it 'leaves following nil' do
203
- @following[2].following.should be_false
204
- end
205
- end
206
- end
207
-
208
- context 'when follower list provided' do
209
- before do
210
- stub_get('/follows/follower/wktk').to_return(:body => fixture('follower_wktk'), :headers => {:content_type => 'text/html'})
211
- @followers = Croudia::Scraper.new.follower('wktk')
212
- end
213
-
214
- it 'gets all users in the page' do
215
- @followers.size.should eq 3
216
- end
217
-
218
- it 'gets username' do
219
- @followers[0].username.should eq 'follower1'
220
- end
221
-
222
- it 'gets nickname' do
223
- @followers[0].nickname.should eq 'follower 1'
224
- end
225
-
226
- it 'gets avatar url' do
227
- @followers[0].avatar.should eq Croudia.endpoint + '/avatar1'
228
- end
229
-
230
- it 'gets description' do
231
- @followers[0].description.should eq 'Description 1'
232
- end
233
-
234
- it 'trims description' do
235
- @followers[0].description.should_not match /^\s|\s$/
236
- end
237
-
238
- context 'when following info provided' do
239
- context 'when following' do
240
- it 'sets following true' do
241
- @followers[0].following.should be_true
242
- end
243
- end
244
-
245
- context 'when not following' do
246
- it 'sets following false' do
247
- @followers[1].following.should be_false
248
- end
249
- end
250
- end
251
-
252
- context 'when following info not provided' do
253
- it 'leaves following nil' do
254
- @followers[2].following.should be_false
255
- end
256
- end
257
- end
258
-
259
- context 'when follow_request list provided' do
260
- before do
261
- stub_get('/follows/follow_request').to_return(:body => fixture('follow_request'), :headers => {:content_type => 'text/html'})
262
- @croudia = Croudia::Scraper.new
263
- @croudia.instance_variable_set('@logged_in', true)
264
- @requests = @croudia.follow_request
265
- end
266
-
267
- it 'gets all users in the page' do
268
- @requests.size.should eq 2
269
- end
270
-
271
- it 'gets username' do
272
- @requests[0].username.should eq 'wktk'
273
- end
274
-
275
- it 'gets nickname' do
276
- @requests[0].nickname.should eq 'wktk!'
277
- end
278
-
279
- it 'gets avatar url' do
280
- @requests[0].avatar.should eq Croudia.endpoint + '/avatar1'
281
- end
282
-
283
- it 'gets description' do
284
- @requests[0].description.should eq "Description 1\nHello"
285
- end
286
-
287
- it 'trims description' do
288
- @requests[0].description.should_not match /^\s|\s$/
289
- end
290
- end
291
- end
292
- end
@@ -1,119 +0,0 @@
1
- require 'helper'
2
-
3
- describe Croudia::Scraper::Parser::Voices do
4
- describe '#voices' do
5
- context 'when parsing timeline' do
6
- before do
7
- stub_get('/voices/timeline').to_return(:body => fixture('voices_timeline'), :headers => {:content_type => 'text/html'})
8
- @croudia = Croudia::Scraper.new
9
- @croudia.instance_variable_set('@logged_in', true)
10
- @timeline = @croudia.timeline
11
- @voice = @timeline[0]
12
- end
13
-
14
- it 'returns an array' do
15
- @timeline.should be_a Array
16
- end
17
-
18
- it 'returns an array of Croudia::Voice' do
19
- @timeline.each do |voice|
20
- voice.should be_a Croudia::Voice
21
- end
22
- end
23
-
24
- it 'gets id' do
25
- @voice.id.should eq '1001'
26
- end
27
-
28
- it 'gets user' do
29
- @voice.user.username.should eq 'username1'
30
- end
31
-
32
- it 'user is a Croudia::User' do
33
- @voice.user.should be_a Croudia::User
34
- end
35
-
36
- it 'gets text' do
37
- @voice.text.should eq 'text 1'
38
- end
39
-
40
- it 'gets favorited_count' do
41
- @voice.favorited_count.should eq 100
42
- end
43
-
44
- it 'converts favorited_count into an Integer' do
45
- @voice.favorited_count.should be_a Integer
46
- end
47
-
48
- it 'gets spreaded_count' do
49
- @voice.spreaded_count.should eq 950
50
- end
51
-
52
- it 'converts spreaded_count into an Integer' do
53
- @voice.spreaded_count.should be_a Integer
54
- end
55
-
56
- it 'gets time' do
57
- @voice.time.should eq Time.at(1356250231)
58
- end
59
-
60
- it 'converts time into a Time' do
61
- if (@voice.time)
62
- @voice.time.should be_a Time
63
- end
64
- end
65
- end
66
-
67
- context 'when parsing reply_list' do
68
- before do
69
- stub_get('/voices/reply_list').to_return(:body => fixture('voices_reply_list'), :headers => {:content_type => 'text/html'})
70
- @croudia = Croudia::Scraper.new
71
- @croudia.instance_variable_set('@logged_in', true)
72
- @reply_list = @croudia.reply_list
73
- @voice = @reply_list[0]
74
- end
75
-
76
- it 'returns an array' do
77
- @reply_list.should be_a Array
78
- end
79
-
80
- it 'returns an array of Croudia::Voice' do
81
- @reply_list.each do |voice|
82
- voice.should be_a Croudia::Voice
83
- end
84
- end
85
-
86
- it 'gets id' do
87
- @voice.id.should eq '1001'
88
- end
89
-
90
- it 'gets user' do
91
- @voice.user.username.should eq 'wktk'
92
- end
93
-
94
- it 'user is a Croudia::User' do
95
- @voice.user.should be_a Croudia::User
96
- end
97
-
98
- it 'gets text' do
99
- @voice.text.should eq '@wktk wktk! wktk! wktk! (^-^)/'
100
- end
101
-
102
- it 'gets favorited_count' do
103
- @voice.favorited_count.should eq 500
104
- end
105
-
106
- it 'converts favorited_count into an Integer' do
107
- @voice.favorited_count.should be_a Integer
108
- end
109
-
110
- it 'gets spreaded_count' do
111
- @voice.spreaded_count.should eq 1000
112
- end
113
-
114
- it 'converts spreaded_count into an Integer' do
115
- @voice.spreaded_count.should be_a Integer
116
- end
117
- end
118
- end
119
- end
@@ -1,78 +0,0 @@
1
- require 'helper'
2
-
3
- describe Croudia::Scraper::Users do
4
- describe '#current_user' do
5
- context 'when logged in' do
6
- before do
7
- @croudia = Croudia::Scraper.new
8
- @croudia.instance_variable_set('@logged_in', true)
9
- stub_get('/users/redirect_user').to_return(:body => fixture('user_wktk1'), :headers => {:content_type => 'text/html'})
10
- end
11
-
12
- it 'gets the correct resource' do
13
- @croudia.current_user
14
- a_get('/users/redirect_user').should have_been_made
15
- end
16
-
17
- it 'returns an object of the current user' do
18
- @croudia.current_user.should be_a Croudia::User
19
- end
20
-
21
- it 'caches @current_user' do
22
- @croudia.current_user
23
- @croudia.current_user
24
- a_get('/users/redirect_user').should have_been_made.once
25
- end
26
-
27
- it 'returns the cached object if exists' do
28
- @current_user = @croudia.current_user
29
- @croudia.current_user.object_id.should eq @current_user.object_id
30
- end
31
-
32
- it 'destroyes the cache when an true argument provided' do
33
- @croudia.current_user(true)
34
- a_get('/users/redirect_user').should have_been_made
35
- end
36
- end
37
-
38
- context 'when not logged in' do
39
- it 'raises an error' do
40
- @croudia = Croudia::Scraper.new
41
- @croudia.instance_variable_set('@logged_in', false)
42
- expect{ @croudia.current_user }.to raise_error Croudia::NotLoggedInError
43
- end
44
- end
45
- end
46
-
47
- describe '#user' do
48
- context 'when an argument provided' do
49
- before do
50
- stub_get('/wktk').to_return(:body => fixture('user_wktk1'), :headers => {:content_type => 'text/html'})
51
- end
52
-
53
- it 'gets the correct resource' do
54
- Croudia::Scraper.new.user('wktk')
55
- a_get('/wktk').should have_been_made
56
- end
57
-
58
- it 'returns a user object' do
59
- Croudia::Scraper.new.user('wktk').should be_a Croudia::User
60
- end
61
- end
62
-
63
- context 'when arguments not provided' do
64
- it 'returns @current_user when logged in' do
65
- @croudia = Croudia::Scraper.new
66
- @croudia.instance_variable_set('@current_user', Croudia::User.new(:username => 'current_user'))
67
- @croudia.instance_variable_set('@logged_in', true)
68
- @croudia.user.to_s.should eq 'current_user'
69
- end
70
-
71
- it 'raises an error when not logged in' do
72
- @croudia = Croudia::Scraper.new
73
- @croudia.instance_variable_set('@logged_in', false)
74
- expect{ @croudia.user }.to raise_error Croudia::NotLoggedInError
75
- end
76
- end
77
- end
78
- end
@@ -1,178 +0,0 @@
1
- require 'helper'
2
-
3
- describe Croudia::Scraper::Voices do
4
- describe '#timeline' do
5
- context 'when logged in' do
6
- before do
7
- stub_get('/voices/timeline').to_return(:body => fixture('voices_timeline'), :headers => {:content_type => 'text/html'})
8
- @croudia = Croudia::Scraper.new
9
- @croudia.instance_variable_set('@logged_in', true)
10
- end
11
-
12
- it 'does not raise an error' do
13
- expect{ @croudia.timeline }.not_to raise_error
14
- end
15
-
16
- it 'gets the correct resource' do
17
- @croudia.timeline
18
- a_get('/voices/timeline').should have_been_made
19
- end
20
-
21
- it 'returns an array' do
22
- @croudia.timeline.should be_a Array
23
- end
24
-
25
- it 'returns an array of Croudia::Voice' do
26
- @croudia.timeline.each do |voice|
27
- voice.should be_a Croudia::Voice
28
- end
29
- end
30
- end
31
-
32
- context 'when not logged in' do
33
- it 'raises an error' do
34
- @croudia = Croudia::Scraper.new
35
- @croudia.instance_variable_set('@logged_in', false)
36
- expect{ @croudia.timeline }.to raise_error Croudia::NotLoggedInError
37
- end
38
- end
39
- end
40
-
41
- describe '#reply_list' do
42
- context 'when logged in' do
43
- before do
44
- stub_get('/voices/reply_list').to_return(:body => fixture('voices_reply_list'), :headers => {:content_type => 'text/html'})
45
- @croudia = Croudia::Scraper.new
46
- @croudia.instance_variable_set('@logged_in', true)
47
- end
48
-
49
- it 'does not raise an error' do
50
- expect{ @croudia.reply_list }.not_to raise_error
51
- end
52
-
53
- it 'gets the correct resource' do
54
- @croudia.reply_list
55
- a_get('/voices/reply_list').should have_been_made
56
- end
57
-
58
- it 'returns an array of Croudia::Voice' do
59
- @croudia.reply_list.each do |voice|
60
- voice.should be_a Croudia::Voice
61
- end
62
- end
63
- end
64
-
65
- context 'when not logged in' do
66
- it 'raises an error' do
67
- @croudia = Croudia::Scraper.new
68
- @croudia.instance_variable_set('@logged_in', false)
69
- expect{ @croudia.reply_list }.to raise_error Croudia::NotLoggedInError
70
- end
71
- end
72
- end
73
-
74
- describe '#update' do
75
- context 'when not logged in' do
76
- it 'raises an error' do
77
- @croudia = Croudia::Scraper.new
78
- @croudia.instance_variable_set('@logged_in', false)
79
- expect{ @croudia.update('Hi') }.to raise_error Croudia::NotLoggedInError
80
- end
81
- end
82
-
83
- context 'when logged in' do
84
- before do
85
- stub_get('/voices/written').to_return(:body => fixture('voices_written'), :headers => {:content_type => 'text/html'})
86
- stub_post('/voices/write').to_return(:headers => {:content_type => 'text/html'})
87
- @croudia = Croudia::Scraper.new
88
- @croudia.instance_variable_set('@logged_in', true)
89
- end
90
-
91
- it 'posts to the correct resource' do
92
- @croudia.update('Hello')
93
- a_get('/voices/written').should have_been_made
94
- a_post('/voices/write').should have_been_made
95
- end
96
- end
97
- end
98
-
99
- describe '#favorite' do
100
- context 'when not logged in' do
101
- it 'raises an error' do
102
- @croudia = Croudia::Scraper.new
103
- @croudia.instance_variable_set('@logged_in', false)
104
- expect{ @croudia.favorite('1') }.to raise_error Croudia::NotLoggedInError
105
- end
106
- end
107
-
108
- context 'when logged in' do
109
- it 'posts to the correct resource' do
110
- @croudia = Croudia::Scraper.new
111
- @croudia.instance_variable_set('@logged_in', true)
112
- stub_post('/favorites').to_return(:headers => {:content_type => 'text/html'})
113
- @croudia.favorite('1')
114
- a_post('/favorites').with(:body => /favorites_action=enable/).should have_been_made
115
- end
116
- end
117
- end
118
-
119
- describe '#unfavorite' do
120
- context 'when not logged in' do
121
- it 'raises an error' do
122
- @croudia = Croudia::Scraper.new
123
- @croudia.instance_variable_set('@logged_in', false)
124
- expect{ @croudia.unfavorite('1') }.to raise_error Croudia::NotLoggedInError
125
- end
126
- end
127
-
128
- context 'when logged in' do
129
- it 'posts to the correct resource' do
130
- @croudia = Croudia::Scraper.new
131
- @croudia.instance_variable_set('@logged_in', true)
132
- stub_post('/favorites').to_return(:headers => {:content_type => 'text/html'})
133
- @croudia.unfavorite('1')
134
- a_post('/favorites').with(:body => /favorites_action=disable/).should have_been_made
135
- end
136
- end
137
- end
138
-
139
- describe '#spread' do
140
- context 'when not logged in' do
141
- it 'raises an error' do
142
- @croudia = Croudia::Scraper.new
143
- @croudia.instance_variable_set('@logged_in', false)
144
- expect{ @croudia.spread('1') }.to raise_error Croudia::NotLoggedInError
145
- end
146
- end
147
-
148
- context 'when logged in' do
149
- it 'posts to the correct resource' do
150
- @croudia = Croudia::Scraper.new
151
- @croudia.instance_variable_set('@logged_in', true)
152
- stub_post('/spreads/spread_voice').to_return(:headers => {:content_type => 'text/html'})
153
- @croudia.spread('1')
154
- a_post('/spreads/spread_voice').with(:body => /favorites_action=enable/).should have_been_made
155
- end
156
- end
157
- end
158
-
159
- describe '#unspread' do
160
- context 'when not logged in' do
161
- it 'raises an error' do
162
- @croudia = Croudia::Scraper.new
163
- @croudia.instance_variable_set('@logged_in', false)
164
- expect{ @croudia.unspread('1') }.to raise_error Croudia::NotLoggedInError
165
- end
166
- end
167
-
168
- context 'when logged in' do
169
- it 'posts to the correct resource' do
170
- @croudia = Croudia::Scraper.new
171
- @croudia.instance_variable_set('@logged_in', true)
172
- stub_post('/spreads/spread_voice').to_return(:headers => {:content_type => 'text/html'})
173
- @croudia.unspread('1')
174
- a_post('/spreads/spread_voice').with(:body => /favorites_action=disable/).should have_been_made
175
- end
176
- end
177
- end
178
- end