scrobbler2 0.0.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/.gitignore +1 -0
- data/README.rdoc +155 -0
- data/Rakefile +8 -0
- data/TODO +23 -0
- data/VERSION.yml +4 -0
- data/generators/acceptance_test/USAGE +9 -0
- data/generators/acceptance_test/acceptance_test_generator.rb +57 -0
- data/generators/acceptance_test/templates/acceptance_test.rb.erb +14 -0
- data/generators/resource/USAGE +8 -0
- data/generators/resource/resource_generator.rb +47 -0
- data/generators/resource/templates/resource.rb.erb +11 -0
- data/generators/resource/templates/spec.rb.erb +22 -0
- data/lib/scrobbler2.rb +23 -0
- data/lib/scrobbler2/album.rb +11 -0
- data/lib/scrobbler2/artist.rb +26 -0
- data/lib/scrobbler2/auth.rb +19 -0
- data/lib/scrobbler2/base.rb +100 -0
- data/lib/scrobbler2/event.rb +12 -0
- data/lib/scrobbler2/geo.rb +15 -0
- data/lib/scrobbler2/group.rb +14 -0
- data/lib/scrobbler2/library.rb +12 -0
- data/lib/scrobbler2/playlist.rb +10 -0
- data/lib/scrobbler2/tag.rb +18 -0
- data/lib/scrobbler2/track.rb +13 -0
- data/lib/scrobbler2/user.rb +29 -0
- data/lib/scrobbler2/venue.rb +12 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/scrobbler2.gemspec +243 -0
- data/tasks/jeweler.rake +15 -0
- data/tasks/rcov.rake +9 -0
- data/tasks/rdoc.rake +7 -0
- data/tasks/tests.rake +10 -0
- data/test/acceptance/album/info_test.rb +56 -0
- data/test/acceptance/artist/add_tags_test.rb +14 -0
- data/test/acceptance/artist/events_test.rb +47 -0
- data/test/acceptance/artist/info_test.rb +53 -0
- data/test/acceptance/artist/shouts_test.rb +48 -0
- data/test/acceptance/artist/similar_artists_test.rb +20 -0
- data/test/acceptance/artist/tags_test.rb +24 -0
- data/test/acceptance/artist/top_albums_test.rb +34 -0
- data/test/acceptance/artist/top_fans.rb +19 -0
- data/test/acceptance/artist/top_tags.rb +18 -0
- data/test/acceptance/artist/top_tracks.rb +47 -0
- data/test/acceptance/auth/auth_test.rb +21 -0
- data/test/acceptance/event/info_test.rb +66 -0
- data/test/acceptance/event/shouts_test.rb +49 -0
- data/test/acceptance/geo/events_test.rb +14 -0
- data/test/acceptance/geo/top_artists_test.rb +16 -0
- data/test/acceptance/geo/top_tracks_test.rb +16 -0
- data/test/acceptance/group/members_test.rb +60 -0
- data/test/acceptance/group/weekly_album_chart_test.rb +61 -0
- data/test/acceptance/group/weekly_artist_chart_test.rb +54 -0
- data/test/acceptance/group/weekly_chart_list_test.rb +39 -0
- data/test/acceptance/group/weekly_track_chart_test.rb +61 -0
- data/test/acceptance/library/albums_test.rb +34 -0
- data/test/acceptance/library/artists_test.rb +33 -0
- data/test/acceptance/library/tracks_test.rb +33 -0
- data/test/acceptance/playlist/fetch_test.rb +68 -0
- data/test/acceptance/shared/album.rb +41 -0
- data/test/acceptance/shared/artist.rb +16 -0
- data/test/acceptance/shared/paged_result.rb +16 -0
- data/test/acceptance/shared/top_fans.rb +29 -0
- data/test/acceptance/shared/top_tags.rb +23 -0
- data/test/acceptance/shared/track.rb +23 -0
- data/test/acceptance/tag/similar_test.rb +15 -0
- data/test/acceptance/tag/top_albums_test.rb +37 -0
- data/test/acceptance/tag/top_artists_test.rb +31 -0
- data/test/acceptance/tag/top_tags_test.rb +32 -0
- data/test/acceptance/tag/top_tracks_test.rb +33 -0
- data/test/acceptance/tag/weekly_artist_chart.rb +54 -0
- data/test/acceptance/tag/weekly_chart_list.rb +39 -0
- data/test/acceptance/test_helper.rb +15 -0
- data/test/acceptance/track/info_test.rb +47 -0
- data/test/acceptance/track/similar_test.rb +22 -0
- data/test/acceptance/track/top_fans_test.rb +23 -0
- data/test/acceptance/track/top_tags_test.rb +24 -0
- data/test/acceptance/user/events_test.rb +27 -0
- data/test/acceptance/user/friends_test.rb +14 -0
- data/test/acceptance/user/info_test.rb +19 -0
- data/test/acceptance/user/loved_tracks_test.rb +14 -0
- data/test/acceptance/user/neighbours_test.rb +14 -0
- data/test/acceptance/user/past_events_test.rb +14 -0
- data/test/acceptance/user/playlists_test.rb +14 -0
- data/test/acceptance/user/recent_tracks_test.rb +14 -0
- data/test/acceptance/user/recommended_artists_test.rb +16 -0
- data/test/acceptance/user/recommended_events_test.rb +16 -0
- data/test/acceptance/user/shouts_test.rb +14 -0
- data/test/acceptance/user/top_albums_test.rb +14 -0
- data/test/acceptance/user/top_artists_test.rb +14 -0
- data/test/acceptance/user/top_tags_test.rb +14 -0
- data/test/acceptance/user/top_tracks_test.rb +14 -0
- data/test/acceptance/user/weekly_album_chart_test.rb +14 -0
- data/test/acceptance/user/weekly_artist_chart_test.rb +14 -0
- data/test/acceptance/user/weekly_chart_list_test.rb +14 -0
- data/test/acceptance/user/weekly_track_chart_test.rb +14 -0
- data/test/acceptance/venue/events_test.rb +14 -0
- data/test/acceptance/venue/past_events_test.rb +14 -0
- data/test/generators/test_acceptance_test_generator.rb +46 -0
- data/test/generators/test_generator_helper.rb +29 -0
- data/test/generators/test_resource_generator.rb +71 -0
- data/test/unit/album_spec.rb +17 -0
- data/test/unit/artist_spec.rb +62 -0
- data/test/unit/auth_spec.rb +22 -0
- data/test/unit/base_spec.rb +193 -0
- data/test/unit/event_spec.rb +23 -0
- data/test/unit/geo_spec.rb +36 -0
- data/test/unit/group_spec.rb +38 -0
- data/test/unit/library_spec.rb +27 -0
- data/test/unit/playlist_spec.rb +18 -0
- data/test/unit/spec_helper.rb +7 -0
- data/test/unit/tag_spec.rb +50 -0
- data/test/unit/track_spec.rb +33 -0
- data/test/unit/user_spec.rb +148 -0
- data/test/unit/venue_spec.rb +29 -0
- metadata +272 -0
data/tasks/jeweler.rake
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
begin
|
2
|
+
require 'jeweler'
|
3
|
+
Jeweler::Tasks.new do |s|
|
4
|
+
s.name = "scrobbler2"
|
5
|
+
s.summary = "A ruby library for accessing the last.fm v2 webservices"
|
6
|
+
s.email = "gingerhendrix@gmail.com"
|
7
|
+
s.homepage = "http://github.com/gingerhendrix/scrobbler2"
|
8
|
+
s.description = "A ruby library for accessing the last.fm v2 webservices"
|
9
|
+
s.authors = ["Gareth Andrew","Kurt Schrader"]
|
10
|
+
s.add_dependency "httparty", ">= 0.2.2"
|
11
|
+
s.add_dependency "activesupport"
|
12
|
+
end
|
13
|
+
rescue LoadError
|
14
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
15
|
+
end
|
data/tasks/rcov.rake
ADDED
data/tasks/rdoc.rake
ADDED
data/tasks/tests.rake
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
|
2
|
+
desc "Run all examples"
|
3
|
+
Spec::Rake::SpecTask.new('test:unit') do |t|
|
4
|
+
t.spec_files = FileList['test/unit/*_spec.rb']
|
5
|
+
end
|
6
|
+
|
7
|
+
desc "Run functional tests"
|
8
|
+
Spec::Rake::SpecTask.new('test:acceptance') do |t|
|
9
|
+
t.spec_files = FileList['test/acceptance/**/*_test.rb'].exclude('test/acceptance/auth/auth_test.rb')
|
10
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
describe "Album info for Ride the Lightning" do
|
4
|
+
|
5
|
+
before(:all) do #We only want to hit the webservice once.
|
6
|
+
@album = Scrobbler2::Album.new "Metallica", "Ride The Lightning"
|
7
|
+
@info = @album.info
|
8
|
+
# puts "INFO: #{@info.inspect} \n"
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should be hash" do
|
12
|
+
@info.should be_kind_of Hash
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should have name 'Metallica'" do
|
16
|
+
@info["name"].should == "Ride the Lightning"
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should have artist 'Metallica'" do
|
20
|
+
@info["artist"].should == "Metallica"
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
it "should have mbid '456efd39-f0dc-4b4d-87c7-82bbc562d8f3'" do
|
25
|
+
@info["mbid"].should == '456efd39-f0dc-4b4d-87c7-82bbc562d8f3'
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should have url 'http://www.last.fm/music/Metallica'" do
|
29
|
+
@info["url"].should == 'http://www.last.fm/music/Metallica/Ride+the+Lightning'
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should have listeners" do
|
33
|
+
@info.should have_key("listeners")
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should have playcount" do
|
37
|
+
@info.should have_key("playcount")
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should have images" do
|
41
|
+
@info["image"].should be_kind_of Array
|
42
|
+
@info["image"][0].should be_kind_of Hash
|
43
|
+
@info["image"][0]['size'].should be_kind_of String
|
44
|
+
@info["image"][0]['#text'].should be_kind_of String
|
45
|
+
#@info["image"][0]['#text'].should == 'http://userserve-ak.last.fm/serve/34/9527793.jpg'
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should have toptags" do
|
49
|
+
pending "TopTags breaks parser" do
|
50
|
+
@info["toptags"].should be_kind_of Hash
|
51
|
+
@info["toptags"]["tags"].should be_kind_of Array
|
52
|
+
@info["toptags"]["tags"][0].should have_key('name')
|
53
|
+
@info["toptags"]["tags"][0].should have_key('url')
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
describe "Add tag 'test' to Metallica" do
|
4
|
+
|
5
|
+
before(:all) do #We only want to hit the webservice once.
|
6
|
+
@artist = Scrobbler2::Artist.new "Metallica"
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should be able to add a tag" do
|
10
|
+
@artist.add_tags ["test"]
|
11
|
+
#TODO: We should probably remove tags before we start, check the tags are applied, and then reset the tags in after(:all)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
describe "Events for Metallica" do
|
4
|
+
|
5
|
+
before(:all) do #We only want to hit the webservice once.
|
6
|
+
@artist = Scrobbler2::Artist.new "Metallica"
|
7
|
+
@events = @artist.events
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should return a Hash" do
|
11
|
+
@events.should be_kind_of(Hash)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should have artist Metallica" do
|
15
|
+
@events['artist'].should == "Metallica"
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should have total" do
|
19
|
+
@events.should have_key('total')
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should have array of events" do
|
23
|
+
@events.should have_key('event')
|
24
|
+
@events['event'].should be_a_kind_of(Array)
|
25
|
+
@events['event'].length.should > 0
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "an event" do
|
29
|
+
|
30
|
+
before(:each) do
|
31
|
+
@event = @events['event'][0]
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should have a url" do
|
35
|
+
@event.should have_key('url')
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should have an array of artists" do
|
39
|
+
@event.should have_key('artists')
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should have a title" do
|
43
|
+
@event.should have_key('title')
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
describe "Artist info for Metallica" do
|
4
|
+
|
5
|
+
before(:all) do #We only want to hit the webservice once.
|
6
|
+
@artist = Scrobbler2::Artist.new "Metallica"
|
7
|
+
@info = @artist.info
|
8
|
+
# puts "INFO: #{@info.inspect} \n"
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should be hash" do
|
12
|
+
@info.should be_kind_of Hash
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should have name 'Metallica'" do
|
16
|
+
@info["name"].should == "Metallica"
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should have mbid '65f4f0c5-ef9e-490c-aee3-909e7ae6b2ab'" do
|
20
|
+
@info["mbid"].should == '65f4f0c5-ef9e-490c-aee3-909e7ae6b2ab'
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should have url 'http://www.last.fm/music/Metallica'" do
|
24
|
+
@info["url"].should == 'http://www.last.fm/music/Metallica'
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should have stats" do
|
28
|
+
@info["stats"].should be_kind_of Hash
|
29
|
+
@info["stats"]["listeners"].should_not be_nil
|
30
|
+
@info["stats"]["playcount"].should_not be_nil
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should have similar artists" do
|
34
|
+
@info["similar"].should be_kind_of Hash
|
35
|
+
@info["similar"]["artist"].should be_kind_of Array
|
36
|
+
@info["similar"]["artist"][0]["name"].should be_kind_of String
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should have images" do
|
40
|
+
@info["image"].should be_kind_of Array
|
41
|
+
@info["image"][0].should be_kind_of Hash
|
42
|
+
@info["image"][0]['size'].should be_kind_of String
|
43
|
+
@info["image"][0]['#text'].should be_kind_of String
|
44
|
+
#@info["image"][0]['#text'].should == 'http://userserve-ak.last.fm/serve/34/9527793.jpg'
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should have bio" do
|
48
|
+
@info["bio"].should be_kind_of Hash
|
49
|
+
@info["bio"]["summary"].match('metal band').should_not be_nil
|
50
|
+
@info["bio"]["content"].match('James Hetfield,').should_not be_nil
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
describe "Shouts for Not Squares" do
|
4
|
+
|
5
|
+
before(:all) do #We only want to hit the webservice once.
|
6
|
+
@artist = Scrobbler2::Artist.new "Not Squares"
|
7
|
+
@shouts = @artist.shouts
|
8
|
+
# puts "#{@shouts.inspect}"
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should return a Hash" do
|
12
|
+
@shouts.should be_kind_of(Hash)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should have artist Not Squares" do
|
16
|
+
@shouts['artist'].should == "Not Squares"
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should have total" do
|
20
|
+
@shouts.should have_key('total')
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should have array of shouts" do
|
24
|
+
@shouts.should have_key('shout')
|
25
|
+
@shouts['shout'].should be_a_kind_of(Array)
|
26
|
+
@shouts['shout'].length.should > 0
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "a shout" do
|
30
|
+
|
31
|
+
before(:each) do
|
32
|
+
@shout = @shouts['shout'][0]
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should have a body" do
|
36
|
+
@shout.should have_key('body')
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should have a author" do
|
40
|
+
@shout.should have_key('author')
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should have a date" do
|
44
|
+
@shout.should have_key('date')
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
describe "Similar artists for Metallica" do
|
4
|
+
|
5
|
+
before(:all) do #We only want to hit the webservice once.
|
6
|
+
@artist = Scrobbler2::Artist.new "Metallica"
|
7
|
+
@similar = @artist.similar
|
8
|
+
# puts "Similar: #{@similar.inspect} \n"
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should be a Hash" do
|
12
|
+
@similar.should be_kind_of Hash
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should have an array of tags" do
|
16
|
+
pending "XML parses currently broken for similar artists"
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
describe "User's tags for Metallica" do
|
4
|
+
|
5
|
+
before(:all) do #We only want to hit the webservice once.
|
6
|
+
@artist = Scrobbler2::Artist.new "Metallica"
|
7
|
+
@tags = @artist.tags
|
8
|
+
# puts "TAGS: #{@tags.inspect} \n"
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should be a Hash" do
|
12
|
+
@tags.should be_kind_of(Hash)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should have artist 'Metallica'" do
|
16
|
+
@tags['artist'].should == 'Metallica'
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should have an array of tags" do
|
20
|
+
@tags['tag'].should be_kind_of(Array)
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
describe "Top Albums for Metallica" do
|
4
|
+
|
5
|
+
before(:all) do #We only want to hit the webservice once.
|
6
|
+
@artist = Scrobbler2::Artist.new "Metallica"
|
7
|
+
@albums = @artist.top_albums
|
8
|
+
# puts "Top Albums: #{@albums.inspect} \n"
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should be a Hash" do
|
12
|
+
@albums.should be_kind_of(Hash)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should have artist 'Metallica'" do
|
16
|
+
@albums["artist"].should == 'Metallica'
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should contain an array of albums" do
|
20
|
+
@albums["album"].should be_kind_of(Array)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should contain 'Ride the Lightning'" do
|
24
|
+
rtl = @albums["album"].find { |album| album['name'] == 'Ride the Lightning' }
|
25
|
+
rtl.should_not be_nil
|
26
|
+
|
27
|
+
rtl['artist'].should be_kind_of(Hash)
|
28
|
+
rtl['artist']['name'].should == 'Metallica'
|
29
|
+
|
30
|
+
rtl['url'].should == "http://www.last.fm/music/Metallica/Ride+the+Lightning"
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
describe "Top Fans for Metallica" do
|
4
|
+
|
5
|
+
before(:all) do #We only want to hit the webservice once.
|
6
|
+
@artist = Scrobbler2::Artist.new "Metallica"
|
7
|
+
@fans = @artist.top_fans
|
8
|
+
end
|
9
|
+
it "should return a Hash" do
|
10
|
+
@fans.should be_kind_of(Hash)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should have artist Metallica" do
|
14
|
+
@fans['artist'].should == "Metallica"
|
15
|
+
end
|
16
|
+
|
17
|
+
it_should_behave_like "Top Fans"
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
describe "Top Tags for Metallica" do
|
4
|
+
|
5
|
+
before(:all) do #We only want to hit the webservice once.
|
6
|
+
@artist = Scrobbler2::Artist.new "Metallica"
|
7
|
+
@tags = @artist.top_tags
|
8
|
+
end
|
9
|
+
it "should return a Hash" do
|
10
|
+
@tags.should be_kind_of(Hash)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should have artist Metallica" do
|
14
|
+
@tags['artist'].should == "Metallica"
|
15
|
+
end
|
16
|
+
|
17
|
+
it_should_behave_like "Top Tags"
|
18
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
describe "Top Tracks for Metallica" do
|
4
|
+
|
5
|
+
before(:all) do #We only want to hit the webservice once.
|
6
|
+
@artist = Scrobbler2::Artist.new "Metallica"
|
7
|
+
@tracks = @artist.top_tracks
|
8
|
+
end
|
9
|
+
it "should return a Hash" do
|
10
|
+
@tracks.should be_kind_of(Hash)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should have artist Metallica" do
|
14
|
+
@tracks['artist'].should == "Metallica"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should have array of tracks" do
|
18
|
+
@tracks.should have_key('track')
|
19
|
+
@tracks['track'].should be_a_kind_of(Array)
|
20
|
+
@tracks['track'].length.should > 0
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "a track" do
|
24
|
+
|
25
|
+
before(:each) do
|
26
|
+
@track = @tracks['track'][0]
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should have a url" do
|
30
|
+
@track.should have_key('url')
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should have a name" do
|
34
|
+
@track.should have_key('name')
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should have a rank" do
|
38
|
+
@track.should have_key('rank')
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should have a playcount" do
|
42
|
+
@track.should have_key('playcount')
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|