lastfm 1.27.3 → 1.27.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.
- checksums.yaml +4 -4
- data/.rspec +2 -2
- data/lastfm.gemspec +3 -3
- data/spec/lastfm_spec.rb +34 -34
- data/spec/method_category_spec.rb +1 -1
- data/spec/method_specs/album_spec.rb +92 -92
- data/spec/method_specs/artist_spec.rb +73 -73
- data/spec/method_specs/chart_spec.rb +13 -13
- data/spec/method_specs/event_spec.rb +3 -3
- data/spec/method_specs/geo_spec.rb +13 -13
- data/spec/method_specs/group_spec.rb +4 -4
- data/spec/method_specs/library_spec.rb +7 -7
- data/spec/method_specs/radio_spec.rb +10 -10
- data/spec/method_specs/tag_spec.rb +28 -28
- data/spec/method_specs/tasteometer_spec.rb +4 -4
- data/spec/method_specs/track_spec.rb +76 -76
- data/spec/method_specs/user_spec.rb +101 -101
- data/spec/response_spec.rb +6 -6
- data/spec/util_spec.rb +16 -16
- metadata +7 -7
@@ -4,30 +4,30 @@ describe '#user' do
|
|
4
4
|
before { init_lastfm }
|
5
5
|
|
6
6
|
it 'should return an instance of Lastfm::User' do
|
7
|
-
@lastfm.user.
|
7
|
+
expect(@lastfm.user).to be_an_instance_of(Lastfm::MethodCategory::User)
|
8
8
|
end
|
9
9
|
|
10
10
|
describe '#get_info' do
|
11
11
|
context 'with params' do
|
12
12
|
it 'should get user info' do
|
13
|
-
@lastfm.
|
13
|
+
expect(@lastfm).to receive(:request).with('user.getInfo', {:user => 'test'}).and_return(make_response('user_get_info'))
|
14
14
|
info = @lastfm.user.get_info(:user => 'test')
|
15
|
-
info['id'].
|
15
|
+
expect(info['id']).to eq('1000002')
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
context 'without params' do
|
20
20
|
it 'should get current user info' do
|
21
|
-
@lastfm.
|
21
|
+
expect(@lastfm).to receive(:request).with('user.getInfo', {}, :get, true, true).and_return(make_response('user_get_info'))
|
22
22
|
info = @lastfm.user.get_info
|
23
|
-
info['id'].
|
23
|
+
expect(info['id']).to eq('1000002')
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
describe '#get_top_artists' do
|
29
29
|
it 'should get user\'s top artists' do
|
30
|
-
@lastfm.
|
30
|
+
expect(@lastfm).to receive(:request).with('user.getTopArtists', {
|
31
31
|
:user => 'test',
|
32
32
|
:period => 'overall',
|
33
33
|
:limit => nil,
|
@@ -38,21 +38,21 @@ describe '#user' do
|
|
38
38
|
:user => 'test',
|
39
39
|
:period => 'overall')
|
40
40
|
|
41
|
-
artists.size.
|
42
|
-
artists[0]['name'].
|
43
|
-
artists[0]['playcount'].
|
41
|
+
expect(artists.size).to eq(3)
|
42
|
+
expect(artists[0]['name']).to eq('Pain of Salvation')
|
43
|
+
expect(artists[0]['playcount']).to eq('1354')
|
44
44
|
|
45
|
-
artists[1]['name'].
|
46
|
-
artists[1]['playcount'].
|
45
|
+
expect(artists[1]['name']).to eq('Opeth')
|
46
|
+
expect(artists[1]['playcount']).to eq('1186')
|
47
47
|
|
48
|
-
artists[2]['name'].
|
49
|
-
artists[2]['playcount'].
|
48
|
+
expect(artists[2]['name']).to eq('Nevermore')
|
49
|
+
expect(artists[2]['playcount']).to eq('959')
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
53
|
describe '#get_personal_tags' do
|
54
54
|
it 'should get user\'s tagged artists' do
|
55
|
-
@lastfm.
|
55
|
+
expect(@lastfm).to receive(:request).with('user.getPersonalTags', {
|
56
56
|
:user => 'test',
|
57
57
|
:tag => 'rock',
|
58
58
|
:taggingtype => 'artist',
|
@@ -63,14 +63,14 @@ describe '#user' do
|
|
63
63
|
artists = @lastfm.user.get_personal_tags(
|
64
64
|
:user => 'test',
|
65
65
|
:tag => 'rock')
|
66
|
-
artists[0]['name'].
|
67
|
-
artists[0]['url'].
|
68
|
-
artists[1]['name'].
|
69
|
-
artists.size.
|
66
|
+
expect(artists[0]['name']).to eq('Afghan Whigs')
|
67
|
+
expect(artists[0]['url']).to eq('http://www.last.fm/music/Afghan+Whigs')
|
68
|
+
expect(artists[1]['name']).to eq('Jeff The Brotherhood')
|
69
|
+
expect(artists.size).to eq(5)
|
70
70
|
end
|
71
71
|
|
72
72
|
it 'should get user\'s tagged albums' do
|
73
|
-
@lastfm.
|
73
|
+
expect(@lastfm).to receive(:request).with('user.getPersonalTags', {
|
74
74
|
:user => 'test',
|
75
75
|
:tag => 'hip-hop',
|
76
76
|
:taggingtype => 'album',
|
@@ -82,12 +82,12 @@ describe '#user' do
|
|
82
82
|
:user => 'test',
|
83
83
|
:tag => 'hip-hop',
|
84
84
|
:taggingtype => 'album')
|
85
|
-
albums[0]['name'].
|
86
|
-
albums.size.
|
85
|
+
expect(albums[0]['name']).to eq('DJ Bizkid Presents: The Best of Atmosphere')
|
86
|
+
expect(albums.size).to eq(1)
|
87
87
|
end
|
88
88
|
|
89
89
|
it 'should get user\'s tagged tracks' do
|
90
|
-
@lastfm.
|
90
|
+
expect(@lastfm).to receive(:request).with('user.getPersonalTags', {
|
91
91
|
:user => 'test',
|
92
92
|
:tag => 'jazz',
|
93
93
|
:taggingtype => 'track',
|
@@ -99,16 +99,16 @@ describe '#user' do
|
|
99
99
|
:user => 'test',
|
100
100
|
:tag => 'jazz',
|
101
101
|
:taggingtype => 'track')
|
102
|
-
tracks[0]['name'].
|
103
|
-
tracks[1]['name'].
|
104
|
-
tracks[1]['duration'].
|
105
|
-
tracks.size.
|
102
|
+
expect(tracks[0]['name']).to eq('Come Together')
|
103
|
+
expect(tracks[1]['name']).to eq('Dione')
|
104
|
+
expect(tracks[1]['duration']).to eq('450')
|
105
|
+
expect(tracks.size).to eq(5)
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
109
|
describe '#get_top_albums' do
|
110
110
|
it 'should get user\'s top albums' do
|
111
|
-
@lastfm.
|
111
|
+
expect(@lastfm).to receive(:request).with('user.getTopAlbums', {
|
112
112
|
:user => 'test',
|
113
113
|
:period => 'overall',
|
114
114
|
:limit => nil,
|
@@ -119,21 +119,21 @@ describe '#user' do
|
|
119
119
|
:user => 'test',
|
120
120
|
:period => 'overall')
|
121
121
|
|
122
|
-
albums.size.
|
122
|
+
expect(albums.size).to eq(2)
|
123
123
|
|
124
|
-
albums[0]['rank'].
|
125
|
-
albums[0]['name'].
|
126
|
-
albums[0]['artist']['name'].
|
124
|
+
expect(albums[0]['rank']).to eq('1')
|
125
|
+
expect(albums[0]['name']).to eq('The Wall')
|
126
|
+
expect(albums[0]['artist']['name']).to eq('Pink Floyd')
|
127
127
|
|
128
|
-
albums[1]['rank'].
|
129
|
-
albums[1]['name'].
|
130
|
-
albums[1]['artist']['name'].
|
128
|
+
expect(albums[1]['rank']).to eq('2')
|
129
|
+
expect(albums[1]['name']).to eq('The Perfect Element, Part I')
|
130
|
+
expect(albums[1]['artist']['name']).to eq('Pain of Salvation')
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
134
134
|
describe '#get_top_tracks' do
|
135
135
|
it 'should get user\'s top tracks' do
|
136
|
-
@lastfm.
|
136
|
+
expect(@lastfm).to receive(:request).with('user.getTopTracks', {
|
137
137
|
:user => 'test',
|
138
138
|
:period => '7day',
|
139
139
|
:limit => nil,
|
@@ -144,21 +144,21 @@ describe '#user' do
|
|
144
144
|
:user => 'test',
|
145
145
|
:period => '7day')
|
146
146
|
|
147
|
-
tracks.size.
|
147
|
+
expect(tracks.size).to eq(2)
|
148
148
|
|
149
|
-
tracks[0]['rank'].
|
150
|
-
tracks[0]['name'].
|
151
|
-
tracks[0]['artist']['name'].
|
149
|
+
expect(tracks[0]['rank']).to eq('1')
|
150
|
+
expect(tracks[0]['name']).to eq('No Light, No Light (TV On The Radio Remix)')
|
151
|
+
expect(tracks[0]['artist']['name']).to eq('Florence + the Machine')
|
152
152
|
|
153
|
-
tracks[1]['rank'].
|
154
|
-
tracks[1]['name'].
|
155
|
-
tracks[1]['artist']['name'].
|
153
|
+
expect(tracks[1]['rank']).to eq('2')
|
154
|
+
expect(tracks[1]['name']).to eq('Backwords (Porcelain Raft cover)')
|
155
|
+
expect(tracks[1]['artist']['name']).to eq('Oupa & Tony Crow')
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
159
159
|
describe '#get_loved_tracks' do
|
160
160
|
it 'should get user\'s loved tracks' do
|
161
|
-
@lastfm.
|
161
|
+
expect(@lastfm).to receive(:request).with('user.getLovedTracks', {
|
162
162
|
:user => 'test',
|
163
163
|
:period => nil,
|
164
164
|
:limit => nil,
|
@@ -167,19 +167,19 @@ describe '#user' do
|
|
167
167
|
|
168
168
|
tracks = @lastfm.user.get_loved_tracks(:user => 'test')
|
169
169
|
|
170
|
-
tracks.size.
|
170
|
+
expect(tracks.size).to eq(2)
|
171
171
|
|
172
|
-
tracks[0]['rank'].
|
173
|
-
tracks[0]['name'].
|
174
|
-
tracks[0]['artist']['name'].
|
172
|
+
expect(tracks[0]['rank']).to eq(nil)
|
173
|
+
expect(tracks[0]['name']).to eq('I Spy')
|
174
|
+
expect(tracks[0]['artist']['name']).to eq('Mikhael Paskalev')
|
175
175
|
|
176
|
-
tracks[1]['rank'].
|
177
|
-
tracks[1]['name'].
|
178
|
-
tracks[1]['artist']['name'].
|
176
|
+
expect(tracks[1]['rank']).to eq(nil)
|
177
|
+
expect(tracks[1]['name']).to eq('Working Titles')
|
178
|
+
expect(tracks[1]['artist']['name']).to eq('Damien Jurado')
|
179
179
|
end
|
180
180
|
|
181
181
|
it 'should always return an array of tracks' do
|
182
|
-
@lastfm.
|
182
|
+
expect(@lastfm).to receive(:request).with('user.getLovedTracks', {
|
183
183
|
:user => 'test',
|
184
184
|
:period => nil,
|
185
185
|
:limit => nil,
|
@@ -188,15 +188,15 @@ describe '#user' do
|
|
188
188
|
|
189
189
|
tracks = @lastfm.user.get_loved_tracks(:user => 'test')
|
190
190
|
|
191
|
-
tracks.size.
|
191
|
+
expect(tracks.size).to eq(1)
|
192
192
|
|
193
|
-
tracks[0]['rank'].
|
194
|
-
tracks[0]['name'].
|
195
|
-
tracks[0]['artist']['name'].
|
193
|
+
expect(tracks[0]['rank']).to eq(nil)
|
194
|
+
expect(tracks[0]['name']).to eq('I Spy')
|
195
|
+
expect(tracks[0]['artist']['name']).to eq('Mikhael Paskalev')
|
196
196
|
end
|
197
197
|
|
198
198
|
it 'should return an empty array when user has 0 loved tracks' do
|
199
|
-
@lastfm.
|
199
|
+
expect(@lastfm).to receive(:request).with('user.getLovedTracks', {
|
200
200
|
:user => 'test',
|
201
201
|
:period => nil,
|
202
202
|
:limit => nil,
|
@@ -205,53 +205,53 @@ describe '#user' do
|
|
205
205
|
|
206
206
|
tracks = @lastfm.user.get_loved_tracks(:user => 'test')
|
207
207
|
|
208
|
-
tracks.size.
|
208
|
+
expect(tracks.size).to eq(0)
|
209
209
|
end
|
210
210
|
end
|
211
211
|
|
212
212
|
describe '#get_friends' do
|
213
213
|
it 'should get user\'s friends' do
|
214
|
-
@lastfm.
|
214
|
+
expect(@lastfm).to receive(:request).with('user.getFriends', {
|
215
215
|
:user => 'test',
|
216
216
|
:recenttracks => nil,
|
217
217
|
:page => nil,
|
218
218
|
:limit => nil
|
219
219
|
}).and_return(make_response('user_get_friends'))
|
220
220
|
friends = @lastfm.user.get_friends(:user => 'test')
|
221
|
-
friends.size.
|
222
|
-
friends[0]['name'].
|
221
|
+
expect(friends.size).to eq(1)
|
222
|
+
expect(friends[0]['name']).to eq('polaroide')
|
223
223
|
end
|
224
224
|
end
|
225
225
|
|
226
226
|
describe '#get_neighbours' do
|
227
227
|
it 'should get user\'s neighbours' do
|
228
|
-
@lastfm.
|
228
|
+
expect(@lastfm).to receive(:request).with('user.getNeighbours', {
|
229
229
|
:user => 'rj',
|
230
230
|
:recenttracks => nil,
|
231
231
|
:page => nil,
|
232
232
|
:limit => nil
|
233
233
|
}).and_return(make_response('user_get_neighbours'))
|
234
234
|
neighbours = @lastfm.user.get_neighbours(:user => 'rj')
|
235
|
-
neighbours.size.
|
236
|
-
neighbours[0]['name'].
|
235
|
+
expect(neighbours.size).to eq(5)
|
236
|
+
expect(neighbours[0]['name']).to eq('willywongi')
|
237
237
|
end
|
238
238
|
end
|
239
239
|
|
240
240
|
describe '#get_new_releases' do
|
241
241
|
it 'should get user\'s new releases' do
|
242
|
-
@lastfm.
|
242
|
+
expect(@lastfm).to receive(:request).with('user.getNewReleases', {
|
243
243
|
:user => 'rj',
|
244
244
|
:userecs => nil
|
245
245
|
}).and_return(make_response('user_get_new_releases'))
|
246
246
|
albums = @lastfm.user.get_new_releases(:user => 'rj')
|
247
|
-
albums.size.
|
248
|
-
albums[0]['name'].
|
247
|
+
expect(albums.size).to eq(20)
|
248
|
+
expect(albums[0]['name']).to eq('Ten Redux')
|
249
249
|
end
|
250
250
|
end
|
251
251
|
|
252
252
|
describe '#get_recent_tracks' do
|
253
253
|
it 'should get user\'s recent tracks' do
|
254
|
-
@lastfm.
|
254
|
+
expect(@lastfm).to receive(:request).with('user.getRecentTracks', {
|
255
255
|
:user => 'test',
|
256
256
|
:page => nil,
|
257
257
|
:limit => nil,
|
@@ -259,12 +259,12 @@ describe '#user' do
|
|
259
259
|
:from => nil
|
260
260
|
}, :get, true, true).and_return(make_response('user_get_recent_tracks'))
|
261
261
|
tracks = @lastfm.user.get_recent_tracks(:user => 'test')
|
262
|
-
tracks[1]['artist']['content'].
|
263
|
-
tracks.size.
|
262
|
+
expect(tracks[1]['artist']['content']).to eq('Kylie Minogue')
|
263
|
+
expect(tracks.size).to eq(2)
|
264
264
|
end
|
265
265
|
|
266
266
|
it 'should not error when a user\'s recent tracks includes malformed data' do
|
267
|
-
@lastfm.
|
267
|
+
expect(@lastfm).to receive(:request).with('user.getRecentTracks', {
|
268
268
|
:user => 'test',
|
269
269
|
:page => nil,
|
270
270
|
:limit => nil,
|
@@ -277,99 +277,99 @@ describe '#user' do
|
|
277
277
|
|
278
278
|
describe '#get_top_tags' do
|
279
279
|
it 'should get user\'s top tags' do
|
280
|
-
@lastfm.
|
280
|
+
expect(@lastfm).to receive(:request).with('user.getTopTags', {
|
281
281
|
:user => 'test',
|
282
282
|
:limit => nil
|
283
283
|
}).and_return(make_response('user_get_top_tags'))
|
284
284
|
tags = @lastfm.user.get_top_tags(:user => 'test')
|
285
|
-
tags[0]['name'].
|
286
|
-
tags[0]['count'].
|
287
|
-
tags[1]['count'].
|
288
|
-
tags.size.
|
285
|
+
expect(tags[0]['name']).to eq('rock')
|
286
|
+
expect(tags[0]['count']).to eq('19')
|
287
|
+
expect(tags[1]['count']).to eq('15')
|
288
|
+
expect(tags.size).to eq(5)
|
289
289
|
end
|
290
290
|
end
|
291
291
|
|
292
292
|
describe '#get_weekly_chart_list' do
|
293
293
|
it 'should get user\'s weekly chart list' do
|
294
|
-
@lastfm.
|
294
|
+
expect(@lastfm).to receive(:request).with('user.getWeeklyChartList', {
|
295
295
|
:user => 'test',
|
296
296
|
:limit => nil,
|
297
297
|
}).and_return(make_response('user_get_weekly_chart_list'))
|
298
298
|
weekly_charts = @lastfm.user.get_weekly_chart_list(:user => 'test')
|
299
|
-
weekly_charts[0]['from'].
|
300
|
-
weekly_charts[0]['to'].
|
301
|
-
weekly_charts[1]['from'].
|
302
|
-
weekly_charts.size.
|
299
|
+
expect(weekly_charts[0]['from']).to eq("1108296002")
|
300
|
+
expect(weekly_charts[0]['to']).to eq("1108900802")
|
301
|
+
expect(weekly_charts[1]['from']).to eq("1108900801")
|
302
|
+
expect(weekly_charts.size).to eq(8)
|
303
303
|
end
|
304
304
|
end
|
305
305
|
|
306
306
|
describe '#get_weekly_artist_chart' do
|
307
307
|
it 'should get user\'s weekly artist chart' do
|
308
|
-
@lastfm.
|
308
|
+
expect(@lastfm).to receive(:request).with('user.getWeeklyArtistChart', {
|
309
309
|
:user => 'test',
|
310
310
|
:limit => nil,
|
311
311
|
:to => nil,
|
312
312
|
:from => nil
|
313
313
|
}).and_return(make_response('user_get_weekly_artist_chart'))
|
314
314
|
weekly_artists = @lastfm.user.get_weekly_artist_chart(:user => 'test')
|
315
|
-
weekly_artists[0]['name'].
|
316
|
-
weekly_artists[0]['playcount'].
|
317
|
-
weekly_artists[1]['playcount'].
|
318
|
-
weekly_artists.size.
|
315
|
+
expect(weekly_artists[0]['name']).to eq("Leonard Cohen")
|
316
|
+
expect(weekly_artists[0]['playcount']).to eq("46")
|
317
|
+
expect(weekly_artists[1]['playcount']).to eq("44")
|
318
|
+
expect(weekly_artists.size).to eq(4)
|
319
319
|
end
|
320
320
|
end
|
321
321
|
|
322
322
|
describe '#get_weekly_album_chart' do
|
323
323
|
it 'should get user\'s weekly album chart' do
|
324
|
-
@lastfm.
|
324
|
+
expect(@lastfm).to receive(:request).with('user.getWeeklyAlbumChart', {
|
325
325
|
:user => 'test',
|
326
326
|
:limit => nil,
|
327
327
|
:to => nil,
|
328
328
|
:from => nil
|
329
329
|
}).and_return(make_response('user_get_weekly_album_chart'))
|
330
330
|
weekly_albums = @lastfm.user.get_weekly_album_chart(:user => 'test')
|
331
|
-
weekly_albums[0]['artist']['content'].
|
332
|
-
weekly_albums[0]['playcount'].
|
333
|
-
weekly_albums[1]['playcount'].
|
334
|
-
weekly_albums.size.
|
331
|
+
expect(weekly_albums[0]['artist']['content']).to eq("Leonard Cohen")
|
332
|
+
expect(weekly_albums[0]['playcount']).to eq("25")
|
333
|
+
expect(weekly_albums[1]['playcount']).to eq("18")
|
334
|
+
expect(weekly_albums.size).to eq(3)
|
335
335
|
end
|
336
336
|
end
|
337
337
|
|
338
338
|
describe '#get_weekly_track_chart' do
|
339
339
|
it 'should get user\'s weekly track chart' do
|
340
|
-
@lastfm.
|
340
|
+
expect(@lastfm).to receive(:request).with('user.getWeeklyTrackChart', {
|
341
341
|
:user => 'test',
|
342
342
|
:limit => nil,
|
343
343
|
:to => nil,
|
344
344
|
:from => nil
|
345
345
|
}).and_return(make_response('user_get_weekly_track_chart'))
|
346
346
|
weekly_tracks = @lastfm.user.get_weekly_track_chart(:user => 'test')
|
347
|
-
weekly_tracks[0]['artist']['content'].
|
348
|
-
weekly_tracks[0]['playcount'].
|
349
|
-
weekly_tracks[1]['playcount'].
|
350
|
-
weekly_tracks.size.
|
347
|
+
expect(weekly_tracks[0]['artist']['content']).to eq("Tori Amos")
|
348
|
+
expect(weekly_tracks[0]['playcount']).to eq("2")
|
349
|
+
expect(weekly_tracks[1]['playcount']).to eq("2")
|
350
|
+
expect(weekly_tracks.size).to eq(3)
|
351
351
|
end
|
352
352
|
end
|
353
353
|
|
354
354
|
describe '#get_recommended_events' do
|
355
355
|
it 'should get a user\'s list of recommended events' do
|
356
|
-
@lastfm.
|
356
|
+
expect(@lastfm).to receive(:request).with('user.getRecommendedEvents', {}, :get, true, true) {
|
357
357
|
make_response('user_get_recommended_events') }
|
358
358
|
|
359
359
|
recommended_events = @lastfm.user.get_recommended_events
|
360
|
-
recommended_events[0]['artists']['headliner'].
|
361
|
-
recommended_events[1]['artists']['headliner'].
|
360
|
+
expect(recommended_events[0]['artists']['headliner']).to eq('Toro y Moi')
|
361
|
+
expect(recommended_events[1]['artists']['headliner']).to eq('Reel Big Fish')
|
362
362
|
end
|
363
363
|
end
|
364
364
|
|
365
365
|
describe '#get_recommended_artists' do
|
366
366
|
it 'shoud get user\'s recommended artists' do
|
367
|
-
@lastfm.
|
367
|
+
expect(@lastfm).to receive(:request).with('user.getRecommendedArtists', {}, :get, true, true) {
|
368
368
|
make_response('user_get_recommended_artists') }
|
369
369
|
|
370
370
|
recommended_artists = @lastfm.user.get_recommended_artists
|
371
|
-
recommended_artists[0]['name'].
|
372
|
-
recommended_artists[1]['name'].
|
371
|
+
expect(recommended_artists[0]['name']).to eq('Quest.Room.Project')
|
372
|
+
expect(recommended_artists[1]['name']).to eq('Senior Soul')
|
373
373
|
end
|
374
374
|
end
|
375
375
|
end
|
data/spec/response_spec.rb
CHANGED
@@ -8,7 +8,7 @@ describe 'Lastfm::Response' do
|
|
8
8
|
|
9
9
|
describe '.new' do
|
10
10
|
it 'should instantiate' do
|
11
|
-
Lastfm::Response.new(@ok).
|
11
|
+
expect(Lastfm::Response.new(@ok)).to be_an_instance_of(Lastfm::Response)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -18,12 +18,12 @@ describe 'Lastfm::Response' do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'should be success' do
|
21
|
-
@response.
|
21
|
+
expect(@response).to be_success
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'should parse response body as xml' do
|
25
25
|
xml = @response.xml
|
26
|
-
xml['similartracks']['track'].size.
|
26
|
+
expect(xml['similartracks']['track'].size).to eq(7)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -33,15 +33,15 @@ describe 'Lastfm::Response' do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'should not be success' do
|
36
|
-
@response.
|
36
|
+
expect(@response).not_to be_success
|
37
37
|
end
|
38
38
|
|
39
39
|
it 'should have message' do
|
40
|
-
@response.message.
|
40
|
+
expect(@response.message).to eq('Invalid API key - You must be granted a valid key by last.fm')
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'should have error number' do
|
44
|
-
@response.error.
|
44
|
+
expect(@response.error).to eq(10)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|