lastfm 1.26.0 → 1.27.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -2
- data/.travis.yml +3 -0
- data/README.md +14 -5
- data/lastfm.gemspec +3 -4
- data/lib/lastfm.rb +0 -1
- data/lib/lastfm/method_category/album.rb +68 -1
- data/lib/lastfm/method_category/artist.rb +7 -0
- data/lib/lastfm/method_category/base.rb +1 -1
- data/lib/lastfm/method_category/track.rb +5 -2
- data/lib/lastfm/method_category/user.rb +2 -2
- data/lib/lastfm/response.rb +19 -1
- data/lib/lastfm/util.rb +6 -11
- data/spec/fixtures/album_get_buylinks.xml +31 -0
- data/spec/fixtures/album_get_info_without_release_date.xml +184 -0
- data/spec/fixtures/album_get_shouts.xml +15 -0
- data/spec/fixtures/album_get_tags.xml +13 -0
- data/spec/fixtures/album_get_top_tags.xml +15 -0
- data/spec/fixtures/album_search.xml +35 -0
- data/spec/fixtures/album_search_no_match.xml +10 -0
- data/spec/fixtures/album_search_single_album.xml +23 -0
- data/spec/fixtures/artist_get_correction.xml +12 -0
- data/spec/fixtures/artist_search.xml +1 -1
- data/spec/fixtures/tag_search.xml +1 -1
- data/spec/fixtures/track_search_no_match.xml +11 -0
- data/spec/fixtures/track_search_single_track.xml +1 -1
- data/spec/fixtures/user_get_loved_tracks_no_tracks.xml +5 -0
- data/spec/fixtures/user_get_loved_tracks_single_track.xml +17 -0
- data/spec/lastfm_spec.rb +34 -34
- data/spec/method_category_spec.rb +1 -1
- data/spec/method_specs/album_spec.rb +255 -25
- data/spec/method_specs/artist_spec.rb +82 -70
- 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 +91 -73
- data/spec/method_specs/user_spec.rb +124 -94
- data/spec/response_spec.rb +6 -6
- data/spec/util_spec.rb +16 -16
- metadata +33 -23
@@ -4,182 +4,194 @@ describe '#artist' do
|
|
4
4
|
before { init_lastfm }
|
5
5
|
|
6
6
|
it 'should return an instance of Lastfm::Artist' do
|
7
|
-
@lastfm.artist.
|
7
|
+
expect(@lastfm.artist).to be_an_instance_of(Lastfm::MethodCategory::Artist)
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#get_correction' do
|
11
|
+
it 'should get corrections' do
|
12
|
+
expect(@lastfm).to receive(:request).with('artist.getCorrection', {
|
13
|
+
:artist => 'Guns N Roses'
|
14
|
+
}).and_return(make_response('artist_get_correction'))
|
15
|
+
|
16
|
+
corrections = @lastfm.artist.get_correction(:artist => 'Guns N Roses')
|
17
|
+
expect(corrections[0]['artist']['name']).to eq("Guns N' Roses")
|
18
|
+
expect(corrections[0]['artist']['url']).to eq('http://www.last.fm/music/Guns+N%27+Roses')
|
19
|
+
end
|
8
20
|
end
|
9
21
|
|
10
22
|
describe '#get_top_tracks' do
|
11
23
|
it 'should get top tracks' do
|
12
|
-
@lastfm.
|
24
|
+
expect(@lastfm).to receive(:request).with('artist.getTopTracks', {
|
13
25
|
:artist => 'Cher'
|
14
26
|
}).and_return(make_response('artist_get_top_tracks'))
|
15
27
|
|
16
28
|
top_tracks = @lastfm.artist.get_top_tracks(:artist => 'Cher')
|
17
|
-
top_tracks.size.
|
29
|
+
expect(top_tracks.size).to be > 1
|
18
30
|
end
|
19
31
|
end
|
20
32
|
|
21
33
|
describe '#get_top_albums' do
|
22
34
|
it 'should get top albums' do
|
23
|
-
@lastfm.
|
35
|
+
expect(@lastfm).to receive(:request).with('artist.getTopAlbums', {
|
24
36
|
:artist => 'Cher'
|
25
37
|
}).and_return(make_response('artist_get_top_albums'))
|
26
38
|
|
27
39
|
top_albums = @lastfm.artist.get_top_albums(:artist => 'Cher')
|
28
|
-
top_albums.size.
|
40
|
+
expect(top_albums.size).to be > 1
|
29
41
|
end
|
30
42
|
end
|
31
43
|
|
32
44
|
describe '#get_top_fans' do
|
33
45
|
it 'should get top fans' do
|
34
|
-
@lastfm.
|
46
|
+
expect(@lastfm).to receive(:request).with('artist.getTopFans', {
|
35
47
|
:artist => 'Cher'
|
36
48
|
}).and_return(make_response('artist_get_top_fans'))
|
37
49
|
|
38
50
|
top_fans = @lastfm.artist.get_top_fans(:artist => 'Cher')
|
39
|
-
top_fans.
|
40
|
-
top_fans.first['name'].
|
51
|
+
expect(top_fans.size).to eql(50)
|
52
|
+
expect(top_fans.first['name']).to eql('D3xperience')
|
41
53
|
end
|
42
54
|
end
|
43
55
|
|
44
56
|
describe '#get_info' do
|
45
57
|
it 'should get info' do
|
46
|
-
@lastfm.
|
58
|
+
expect(@lastfm).to receive(:request).with('artist.getInfo', {
|
47
59
|
:artist => 'Cher'
|
48
60
|
}).and_return(make_response('artist_get_info'))
|
49
61
|
|
50
62
|
artist = @lastfm.artist.get_info(:artist => 'Cher')
|
51
|
-
artist['name'].
|
52
|
-
artist['mbid'].
|
53
|
-
artist['url'].
|
54
|
-
artist['image'].size.
|
63
|
+
expect(artist['name']).to eq('Cher')
|
64
|
+
expect(artist['mbid']).to eq('bfcc6d75-a6a5-4bc6-8282-47aec8531818')
|
65
|
+
expect(artist['url']).to eq('http://www.last.fm/music/Cher')
|
66
|
+
expect(artist['image'].size).to eq(5)
|
55
67
|
end
|
56
68
|
end
|
57
69
|
|
58
70
|
describe '#get_events' do
|
59
71
|
it 'should get events' do
|
60
|
-
@lastfm.
|
72
|
+
expect(@lastfm).to receive(:request).with('artist.getEvents', {
|
61
73
|
:artist => 'Cher'
|
62
74
|
}).and_return(make_response('artist_get_events'))
|
63
75
|
|
64
76
|
events = @lastfm.artist.get_events(:artist => 'Cher')
|
65
|
-
events.size.
|
66
|
-
events[0]['title'].
|
67
|
-
events[0]['artists'].size.
|
68
|
-
events[0]['artists']['headliner'].
|
69
|
-
events[0]['venue']['name'].
|
70
|
-
events[0]['venue']['location']['city'].
|
71
|
-
events[0]['venue']['location']['point']['lat'].
|
72
|
-
events[0]['image'].size.
|
73
|
-
events[0]['image'][0]['size'].
|
74
|
-
events[0]['image'][0]['content'].
|
75
|
-
events[0]['startDate'].
|
76
|
-
events[0]['tickets']['ticket']['supplier'].
|
77
|
-
events[0]['tickets']['ticket']['content'].
|
78
|
-
events[0]['tags']['tag'].
|
77
|
+
expect(events.size).to eq(1)
|
78
|
+
expect(events[0]['title']).to eq('Cher')
|
79
|
+
expect(events[0]['artists'].size).to eq(2)
|
80
|
+
expect(events[0]['artists']['headliner']).to eq('Cher')
|
81
|
+
expect(events[0]['venue']['name']).to eq('The Colosseum At Caesars Palace')
|
82
|
+
expect(events[0]['venue']['location']['city']).to eq('Las Vegas(, NV)')
|
83
|
+
expect(events[0]['venue']['location']['point']['lat']).to eq('36.116143')
|
84
|
+
expect(events[0]['image'].size).to eq(4)
|
85
|
+
expect(events[0]['image'][0]['size']).to eq('small')
|
86
|
+
expect(events[0]['image'][0]['content']).to eq('http://userserve-ak.last.fm/serve/34/34814037.jpg')
|
87
|
+
expect(events[0]['startDate']).to eq('Sat, 23 Oct 2010 19:30:00')
|
88
|
+
expect(events[0]['tickets']['ticket']['supplier']).to eq('TicketMaster')
|
89
|
+
expect(events[0]['tickets']['ticket']['content']).to eq('http://www.last.fm/affiliate/byid/29/1584537/12/ws.artist.events.b25b959554ed76058ac220b7b2e0a026')
|
90
|
+
expect(events[0]['tags']['tag']).to eq(['pop', 'dance', 'female vocalists', '80s', 'cher'])
|
79
91
|
end
|
80
92
|
end
|
81
93
|
|
82
94
|
describe '#get_images' do
|
83
95
|
it 'should get images' do
|
84
|
-
@lastfm.
|
96
|
+
expect(@lastfm).to receive(:request).with('artist.getImages', {
|
85
97
|
:artist => 'Cher',
|
86
98
|
}).and_return(make_response('artist_get_images'))
|
87
99
|
|
88
100
|
images = @lastfm.artist.get_images(:artist => 'Cher')
|
89
|
-
images.count.
|
90
|
-
images[1]['title'].
|
91
|
-
images[1]['url'].
|
92
|
-
images[1]['dateadded'].
|
93
|
-
images[1]['format'].
|
94
|
-
images[1]['owner']['type'].
|
95
|
-
images[1]['owner']['name'].
|
96
|
-
images[1]['owner']['url'].
|
97
|
-
images[1]['sizes']['size'].length.
|
101
|
+
expect(images.count).to eq(2)
|
102
|
+
expect(images[1]['title']).to eq('Early years')
|
103
|
+
expect(images[1]['url']).to eq('http://www.last.fm/music/Cher/+images/34877783')
|
104
|
+
expect(images[1]['dateadded']).to eq('Tue, 8 Sep 2009 05:40:36')
|
105
|
+
expect(images[1]['format']).to eq('jpg')
|
106
|
+
expect(images[1]['owner']['type']).to eq('user')
|
107
|
+
expect(images[1]['owner']['name']).to eq('djosci_coelho')
|
108
|
+
expect(images[1]['owner']['url']).to eq('http://www.last.fm/user/djosci_coelho')
|
109
|
+
expect(images[1]['sizes']['size'].length).to eq(6)
|
98
110
|
end
|
99
111
|
end
|
100
112
|
|
101
113
|
describe '#get_similar' do
|
102
114
|
it 'should get similar artists' do
|
103
|
-
@lastfm.
|
115
|
+
expect(@lastfm).to receive(:request).with('artist.getSimilar', {
|
104
116
|
:artist => 'kid606'
|
105
117
|
}).and_return(make_response('artist_get_similar'))
|
106
118
|
|
107
119
|
artists = @lastfm.artist.get_similar(:artist => 'kid606')
|
108
|
-
artists.size.
|
109
|
-
artists[1]['name'].
|
110
|
-
artists[1]['mbid'].
|
111
|
-
artists[1]['match'].
|
112
|
-
artists[1]['url'].
|
113
|
-
artists[1]['image'].
|
120
|
+
expect(artists.size).to eq(2)
|
121
|
+
expect(artists[1]['name']).to eq('Venetian Snares')
|
122
|
+
expect(artists[1]['mbid']).to eq('56abaa47-0101-463b-b37e-e961136fec39')
|
123
|
+
expect(artists[1]['match']).to eq('100')
|
124
|
+
expect(artists[1]['url']).to eq('/music/Venetian+Snares')
|
125
|
+
expect(artists[1]['image']).to eq(['http://userserve-ak.last.fm/serve/160/211799.jpg'])
|
114
126
|
end
|
115
127
|
end
|
116
128
|
|
117
129
|
describe '#get_tags' do
|
118
130
|
it 'should get artist tags' do
|
119
|
-
@lastfm.
|
131
|
+
expect(@lastfm).to receive(:request).with('artist.getTags', {
|
120
132
|
:artist => 'zebrahead',
|
121
133
|
:user => 'test',
|
122
134
|
:autocorrect => nil
|
123
135
|
}).and_return(make_response('artist_get_tags'))
|
124
136
|
|
125
137
|
tags = @lastfm.artist.get_tags(:artist => 'zebrahead', :user => 'test')
|
126
|
-
tags.size.
|
127
|
-
tags[0]['name'].
|
128
|
-
tags[1]['name'].
|
138
|
+
expect(tags.size).to eq(2)
|
139
|
+
expect(tags[0]['name']).to eq('punk')
|
140
|
+
expect(tags[1]['name']).to eq('Awesome')
|
129
141
|
end
|
130
142
|
end
|
131
143
|
|
132
144
|
describe '#get_top_tags' do
|
133
145
|
context 'with artist' do
|
134
146
|
it 'should get artist top tags' do
|
135
|
-
@lastfm.
|
147
|
+
expect(@lastfm).to receive(:request).with('artist.getTopTags', {
|
136
148
|
:artist => 'Giorgio Moroder',
|
137
149
|
:autocorrect => nil
|
138
150
|
}).and_return(make_response('artist_get_top_tags'))
|
139
151
|
|
140
152
|
tags = @lastfm.artist.get_top_tags(:artist => 'Giorgio Moroder')
|
141
|
-
tags.size.
|
142
|
-
tags[0]['name'].
|
143
|
-
tags[0]['count'].
|
144
|
-
tags[0]['url'].
|
145
|
-
tags[1]['name'].
|
146
|
-
tags[1]['count'].
|
147
|
-
tags[1]['url'].
|
153
|
+
expect(tags.size).to eq(5)
|
154
|
+
expect(tags[0]['name']).to eq('electronic')
|
155
|
+
expect(tags[0]['count']).to eq('100')
|
156
|
+
expect(tags[0]['url']).to eq('http://www.last.fm/tag/electronic')
|
157
|
+
expect(tags[1]['name']).to eq('Disco')
|
158
|
+
expect(tags[1]['count']).to eq('97')
|
159
|
+
expect(tags[1]['url']).to eq('http://www.last.fm/tag/disco')
|
148
160
|
end
|
149
161
|
end
|
150
162
|
|
151
163
|
context 'with mbid' do
|
152
164
|
it 'should get artist top tags' do
|
153
|
-
@lastfm.
|
165
|
+
expect(@lastfm).to receive(:request).with('artist.getTopTags', {
|
154
166
|
:mbid => 'xxxxx',
|
155
167
|
:autocorrect => nil
|
156
168
|
}).and_return(make_response('artist_get_top_tags'))
|
157
169
|
|
158
170
|
tags = @lastfm.artist.get_top_tags(:mbid => 'xxxxx')
|
159
|
-
tags.size.
|
160
|
-
tags[0]['name'].
|
161
|
-
tags[0]['count'].
|
162
|
-
tags[0]['url'].
|
163
|
-
tags[1]['name'].
|
164
|
-
tags[1]['count'].
|
165
|
-
tags[1]['url'].
|
171
|
+
expect(tags.size).to eq(5)
|
172
|
+
expect(tags[0]['name']).to eq('electronic')
|
173
|
+
expect(tags[0]['count']).to eq('100')
|
174
|
+
expect(tags[0]['url']).to eq('http://www.last.fm/tag/electronic')
|
175
|
+
expect(tags[1]['name']).to eq('Disco')
|
176
|
+
expect(tags[1]['count']).to eq('97')
|
177
|
+
expect(tags[1]['url']).to eq('http://www.last.fm/tag/disco')
|
166
178
|
end
|
167
179
|
end
|
168
180
|
end
|
169
181
|
|
170
182
|
describe '#search' do
|
171
183
|
it 'should search' do
|
172
|
-
@lastfm.
|
184
|
+
expect(@lastfm).to receive(:request).with('artist.search', {
|
173
185
|
:artist => 'RADWIMPS',
|
174
186
|
:limit => 10,
|
175
187
|
:page => 3,
|
176
188
|
}).and_return(make_response('artist_search'))
|
177
189
|
|
178
190
|
tracks = @lastfm.artist.search(:artist => 'RADWIMPS', :limit => 10, :page => 3)
|
179
|
-
tracks['results']['for'].
|
180
|
-
tracks['results']['totalResults'].
|
181
|
-
tracks['results']['artistmatches']['artist'].size.
|
182
|
-
tracks['results']['artistmatches']['artist'][0]['name'].
|
191
|
+
expect(tracks['results']['for']).to eq('RADWIMPS')
|
192
|
+
expect(tracks['results']['totalResults']).to eq('3')
|
193
|
+
expect(tracks['results']['artistmatches']['artist'].size).to eq(3)
|
194
|
+
expect(tracks['results']['artistmatches']['artist'][0]['name']).to eq('RADWIMPS')
|
183
195
|
end
|
184
196
|
end
|
185
197
|
end
|
@@ -4,78 +4,78 @@ describe '#chart' do
|
|
4
4
|
before { init_lastfm }
|
5
5
|
|
6
6
|
it 'should return an instance of Lastfm::Chart' do
|
7
|
-
@lastfm.chart.
|
7
|
+
expect(@lastfm.chart).to be_an_instance_of(Lastfm::MethodCategory::Chart)
|
8
8
|
end
|
9
9
|
|
10
10
|
describe '#get_hyped_artists' do
|
11
11
|
it 'should get hyped artists' do
|
12
|
-
@lastfm.
|
12
|
+
expect(@lastfm).to receive(:request).with('chart.getHypedArtists', {
|
13
13
|
:limit => 10,
|
14
14
|
:page => 3
|
15
15
|
}).and_return(make_response('chart_get_hyped_artists'))
|
16
16
|
|
17
17
|
hyped_artists = @lastfm.chart.get_hyped_artists(:limit => 10, :page => 3)
|
18
|
-
hyped_artists.size.
|
18
|
+
expect(hyped_artists.size).to be > 1
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
describe '#get_hyped_tracks' do
|
23
23
|
it 'should get hyped tracks' do
|
24
|
-
@lastfm.
|
24
|
+
expect(@lastfm).to receive(:request).with('chart.getHypedTracks', {
|
25
25
|
:limit => 10,
|
26
26
|
:page => 3
|
27
27
|
}).and_return(make_response('chart_get_hyped_tracks'))
|
28
28
|
|
29
29
|
hyped_tracks = @lastfm.chart.get_hyped_tracks(:limit => 10, :page => 3)
|
30
|
-
hyped_tracks.size.
|
30
|
+
expect(hyped_tracks.size).to be > 1
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
34
|
describe '#get_loved_tracks' do
|
35
35
|
it 'should get loved tracks' do
|
36
|
-
@lastfm.
|
36
|
+
expect(@lastfm).to receive(:request).with('chart.getLovedTracks', {
|
37
37
|
:limit => 10,
|
38
38
|
:page => 3
|
39
39
|
}).and_return(make_response('chart_get_loved_tracks'))
|
40
40
|
|
41
41
|
loved_tracks = @lastfm.chart.get_loved_tracks(:limit => 10, :page => 3)
|
42
|
-
loved_tracks.size.
|
42
|
+
expect(loved_tracks.size).to be > 1
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
46
|
describe '#get_top_artists' do
|
47
47
|
it 'should get top artists' do
|
48
|
-
@lastfm.
|
48
|
+
expect(@lastfm).to receive(:request).with('chart.getTopArtists', {
|
49
49
|
:limit => 10,
|
50
50
|
:page => 3
|
51
51
|
}).and_return(make_response('chart_get_top_artists'))
|
52
52
|
|
53
53
|
top_artists = @lastfm.chart.get_top_artists(:limit => 10, :page => 3)
|
54
|
-
top_artists.size.
|
54
|
+
expect(top_artists.size).to be > 1
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
58
|
describe '#get_top_tags' do
|
59
59
|
it 'should get top tags' do
|
60
|
-
@lastfm.
|
60
|
+
expect(@lastfm).to receive(:request).with('chart.getTopTags', {
|
61
61
|
:limit => 10,
|
62
62
|
:page => 3
|
63
63
|
}).and_return(make_response('chart_get_top_tags'))
|
64
64
|
|
65
65
|
top_tags = @lastfm.chart.get_top_tags(:limit => 10, :page => 3)
|
66
|
-
top_tags.size.
|
66
|
+
expect(top_tags.size).to be > 1
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
70
|
describe '#get_top_tracks' do
|
71
71
|
it 'should get top tracks' do
|
72
|
-
@lastfm.
|
72
|
+
expect(@lastfm).to receive(:request).with('chart.getTopTracks', {
|
73
73
|
:limit => 10,
|
74
74
|
:page => 3
|
75
75
|
}).and_return(make_response('chart_get_top_tracks'))
|
76
76
|
|
77
77
|
top_tracks = @lastfm.chart.get_top_tracks(:limit => 10, :page => 3)
|
78
|
-
top_tracks.size.
|
78
|
+
expect(top_tracks.size).to be > 1
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
@@ -2,16 +2,16 @@ describe '#event' do
|
|
2
2
|
before { init_lastfm }
|
3
3
|
|
4
4
|
it 'should return an instance of Lastfm::Event' do
|
5
|
-
@lastfm.event.
|
5
|
+
expect(@lastfm.event).to be_an_instance_of(Lastfm::MethodCategory::Event)
|
6
6
|
end
|
7
7
|
|
8
8
|
describe '#get_info' do
|
9
9
|
it 'should get info' do
|
10
|
-
@lastfm.
|
10
|
+
expect(@lastfm).to receive(:request).with('event.getInfo', {
|
11
11
|
:event => 1073657
|
12
12
|
}).and_return(make_response('event_get_info'))
|
13
13
|
info = @lastfm.event.get_info(:event => 1073657)
|
14
|
-
info['title'].
|
14
|
+
expect(info['title']).to eq('Neko Case')
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -4,12 +4,12 @@ describe '#geo' do
|
|
4
4
|
before { init_lastfm }
|
5
5
|
|
6
6
|
it 'should return an instance of Lastfm::Geo' do
|
7
|
-
@lastfm.geo.
|
7
|
+
expect(@lastfm.geo).to be_an_instance_of(Lastfm::MethodCategory::Geo)
|
8
8
|
end
|
9
9
|
|
10
10
|
describe '#get_events' do
|
11
11
|
it 'should get events' do
|
12
|
-
@lastfm.
|
12
|
+
expect(@lastfm).to receive(:request).with('geo.getEvents', {
|
13
13
|
:location => 'Boulder',
|
14
14
|
:distance => nil,
|
15
15
|
:limit => nil,
|
@@ -17,17 +17,17 @@ describe '#geo' do
|
|
17
17
|
}).and_return(make_response('geo_get_events'))
|
18
18
|
|
19
19
|
events = @lastfm.geo.get_events(:location => 'Boulder')
|
20
|
-
events.size.
|
21
|
-
events[0]['title'].
|
22
|
-
events[0]['artists'].size.
|
23
|
-
events[0]['artists']['headliner'].
|
24
|
-
events[0]['venue']['name'].
|
25
|
-
events[0]['venue']['location']['city'].
|
26
|
-
events[0]['venue']['location']['point']['lat'].
|
27
|
-
events[0]['image'].size.
|
28
|
-
events[0]['image'][0]['size'].
|
29
|
-
events[0]['image'][0]['content'].
|
30
|
-
events[0]['startDate'].
|
20
|
+
expect(events.size).to eq(1)
|
21
|
+
expect(events[0]['title']).to eq('Transistor Festival')
|
22
|
+
expect(events[0]['artists'].size).to eq(2)
|
23
|
+
expect(events[0]['artists']['headliner']).to eq('Not Breathing')
|
24
|
+
expect(events[0]['venue']['name']).to eq('The Walnut Room')
|
25
|
+
expect(events[0]['venue']['location']['city']).to eq('Denver, CO')
|
26
|
+
expect(events[0]['venue']['location']['point']['lat']).to eq('39.764316')
|
27
|
+
expect(events[0]['image'].size).to eq(4)
|
28
|
+
expect(events[0]['image'][0]['size']).to eq('small')
|
29
|
+
expect(events[0]['image'][0]['content']).to eq('http://userserve-ak.last.fm/serve/34/166214.jpg')
|
30
|
+
expect(events[0]['startDate']).to eq('Fri, 10 Jun 2011 01:58:01')
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -4,19 +4,19 @@ describe '#group' do
|
|
4
4
|
before { init_lastfm }
|
5
5
|
|
6
6
|
it 'should return an instance of Lastfm::Group' do
|
7
|
-
@lastfm.group.
|
7
|
+
expect(@lastfm.group).to be_an_instance_of(Lastfm::MethodCategory::Group)
|
8
8
|
end
|
9
9
|
|
10
10
|
describe '#get_members' do
|
11
11
|
it 'should get the members\' info' do
|
12
|
-
@lastfm.
|
12
|
+
expect(@lastfm).to receive(:request).with('group.getMembers', {
|
13
13
|
:group => 'Linux',
|
14
14
|
:limit => nil,
|
15
15
|
:page => nil
|
16
16
|
}).and_return(make_response('group_get_members'))
|
17
17
|
members = @lastfm.group.get_members(:group => 'Linux')
|
18
|
-
members[0]['name'].
|
19
|
-
members.size.
|
18
|
+
expect(members[0]['name']).to eq('RJ')
|
19
|
+
expect(members.size).to eq(1)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -4,12 +4,12 @@ describe '#library' do
|
|
4
4
|
before { init_lastfm }
|
5
5
|
|
6
6
|
it 'should return an instance of Lastfm::Library' do
|
7
|
-
@lastfm.library.
|
7
|
+
expect(@lastfm.library).to be_an_instance_of(Lastfm::MethodCategory::Library)
|
8
8
|
end
|
9
9
|
|
10
10
|
describe '#get_tracks' do
|
11
11
|
it 'should get the tracks\' info' do
|
12
|
-
@lastfm.
|
12
|
+
expect(@lastfm).to receive(:request).with('library.getTracks', {
|
13
13
|
:user => 'test',
|
14
14
|
:artist => 'foo',
|
15
15
|
:album => 'bar',
|
@@ -17,21 +17,21 @@ describe '#library' do
|
|
17
17
|
:page => nil
|
18
18
|
}).and_return(make_response('library_get_tracks'))
|
19
19
|
tracks = @lastfm.library.get_tracks(:user => 'test', :artist => 'foo', :album => 'bar')
|
20
|
-
tracks[0]['name'].
|
21
|
-
tracks.size.
|
20
|
+
expect(tracks[0]['name']).to eq('Learning to Live')
|
21
|
+
expect(tracks.size).to eq(1)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
describe '#get_artists' do
|
26
26
|
it 'should get the artists\' info' do
|
27
|
-
@lastfm.
|
27
|
+
expect(@lastfm).to receive(:request).with('library.getArtists', {
|
28
28
|
:user => 'test',
|
29
29
|
:limit => nil,
|
30
30
|
:page => nil
|
31
31
|
}).and_return(make_response('library_get_artists'))
|
32
32
|
artists = @lastfm.library.get_artists(:user => 'test')
|
33
|
-
artists[1]['name'].
|
34
|
-
artists.size.
|
33
|
+
expect(artists[1]['name']).to eq('Dark Castle')
|
34
|
+
expect(artists.size).to eq(2)
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|