scrobbler-ng 2.0.10 → 2.0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,35 +0,0 @@
1
- # encoding: utf-8
2
-
3
- ## ## library.getartists
4
- {
5
- 'api_key=foo123&user=xhochy' => 'artists-p1.xml',
6
- 'limit=30&api_key=foo123&user=xhochy' => 'artists-f30.xml'
7
- }.each do |url, file|
8
- register_fw('method=library.getartists&' + url, 'library', file)
9
- end
10
- (1..7).each do |n|
11
- register_fw('method=library.getartists&page=' + n.to_s +
12
- '&api_key=foo123&user=xhochy', 'library', "artists-p#{n}.xml")
13
- end
14
-
15
- ## ## library.gettracks
16
- {
17
- 'api_key=foo123&user=xhochy' => 'tracks-p1.xml',
18
- 'limit=30&api_key=foo123&user=xhochy' => 'tracks-f30.xml'
19
- }.each do |url, file|
20
- register_fw('method=library.gettracks&' + url, 'library', file)
21
- end
22
- (1..34).each do |n|
23
- register_fw("user=xhochy&page=#{n}&api_key=foo123&method=library.gettracks",
24
- 'library', "tracks-p#{n}.xml")
25
- end
26
-
27
- ## ## library.getalbums
28
- FakeWeb.register_uri(:get, WEB_BASE + 'limit=30&user=xhochy&api_key=foo123&method=library.getalbums', :body => File.join([FIXTURES_BASE, 'library', 'albums-f30.xml']))
29
- FakeWeb.register_uri(:get, WEB_BASE + 'user=xhochy&api_key=foo123&method=library.getalbums', :body => File.join([FIXTURES_BASE, 'library', 'albums-p1.xml']))
30
- (1..8).each do |n|
31
- FakeWeb.register_uri(:get, WEB_BASE + 'method=library.getalbums&page=' +
32
- n.to_s + '&api_key=foo123&user=xhochy',
33
- :body => File.join([FIXTURES_BASE, 'library', 'albums-p' +
34
- n.to_s + '.xml']))
35
- end
@@ -1,127 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'rubygems'
4
- require 'fakeweb'
5
-
6
- FIXTURES_BASE = File.join([File.dirname(__FILE__), '..', 'fixtures', 'xml'])
7
- WEB_BASE = 'http://ws.audioscrobbler.com:80/2.0/?'
8
- FakeWeb.allow_net_connect = false
9
-
10
- def register_fw(uri, *args)
11
- FakeWeb.register_uri(:get, WEB_BASE + uri,
12
- :body => File.join([FIXTURES_BASE] + args))
13
- end
14
-
15
- ## Library
16
- require File.expand_path('library.rb', File.dirname(__FILE__))
17
-
18
- ## Event
19
- register_fw('method=event.getattendees&event=328799&api_key=foo123',
20
- 'event', 'attendees.xml')
21
- register_fw('event=328799&api_key=foo123&method=event.getshouts',
22
- 'event', 'shouts.xml')
23
- register_fw('event=328799&api_key=foo123&method=event.getinfo',
24
- 'event', 'event.xml')
25
- FakeWeb.register_uri(:post, WEB_BASE + 'api_key=foo123&event=328799&method=event.attend&sk=d580d57f32848f5dcf574d1ce18d78b2&status=1&api_sig=c476ec753082205327b0f6ef922d82c8',
26
- :body => File.join([FIXTURES_BASE, 'event', 'attend.xml']))
27
-
28
- ## Tag
29
- register_fw('tag=rock&api_key=foo123&method=tag.gettoptracks',
30
- 'tag', 'toptracks.xml')
31
- register_fw('method=tag.gettoptags&api_key=foo123',
32
- 'tag', 'toptags.xml')
33
- register_fw('method=tag.getsimilar&tag=rock&api_key=foo123',
34
- 'tag', 'similar.xml')
35
- register_fw('tag=rock&api_key=foo123&method=tag.gettopartists',
36
- 'tag', 'topartists.xml')
37
- register_fw('tag=rock&api_key=foo123&method=tag.gettopalbums',
38
- 'tag', 'topalbums.xml')
39
-
40
- ## Venue
41
- register_fw('method=venue.getevents&api_key=foo123&venue=9027137',
42
- 'venue', 'events.xml')
43
- register_fw('method=venue.getpastevents&api_key=foo123&venue=9027137',
44
- 'venue', 'events.xml')
45
-
46
- ## Auth
47
- register_fw('api_key=foo123&method=auth.gettoken&api_sig=d062b3b3fa109d048732819d27d04689',
48
- 'auth', 'token.xml')
49
- register_fw('api_key=foo123&method=auth.getsession&token=test123token&api_sig=f4a839c10a010368bd1058725c253dfb',
50
- 'auth', 'session.xml')
51
-
52
- ## Artist
53
- register_fw('artist=Metallica&method=artist.getinfo&api_key=foo123',
54
- 'artist', 'info.xml')
55
- register_fw('artist=Metallica&api_key=foo123&method=artist.gettoptags',
56
- 'artist', 'toptags.xml')
57
- register_fw('artist=Metallica&api_key=foo123&method=artist.gettopfans',
58
- 'artist', 'fans.xml')
59
- register_fw('artist=Metallica&api_key=foo123&method=artist.gettopalbums',
60
- 'artist', 'topalbums.xml')
61
- register_fw('artist=Metallica&api_key=foo123&method=artist.getsimilar',
62
- 'artist', 'similar.xml')
63
- register_fw('artist=Metallica&api_key=foo123&method=artist.gettoptracks',
64
- 'artist', 'toptracks.xml')
65
-
66
- ## Track
67
- register_fw('api_key=foo123&method=track.getinfo&artist=Carrie%20Underwood&track=Before%20He%20Cheats',
68
- 'track', 'info.xml')
69
- register_fw('artist=Cher&track=Before%20He%20Cheats&api_key=foo123&method=track.gettopfans',
70
- 'track', 'fans.xml')
71
- register_fw('artist=Cher&track=Before%20He%20Cheats&api_key=foo123&method=track.gettoptags',
72
- 'track', 'toptags.xml')
73
- register_fw('fingerprintid=1234&api_key=foo123&method=track.getFingerprintMetadata',
74
- 'track', 'fingerprintmetadata.xml')
75
-
76
- ## Geo
77
- FakeWeb.register_uri(:get, WEB_BASE + 'location=Manchester&api_key=foo123&method=geo.getevents', :body => File.join([FIXTURES_BASE, 'geo', 'events-p1.xml']))
78
- FakeWeb.register_uri(:get, WEB_BASE + 'location=Manchester&page=2&api_key=foo123&method=geo.getevents', :body => File.join([FIXTURES_BASE, 'geo', 'events-p2.xml']))
79
- FakeWeb.register_uri(:get, WEB_BASE + 'location=Manchester&page=3&api_key=foo123&method=geo.getevents', :body => File.join([FIXTURES_BASE, 'geo', 'events-p3.xml']))
80
- FakeWeb.register_uri(:get, WEB_BASE + 'distance=15&api_key=foo123&method=geo.getevents', :body => File.join([FIXTURES_BASE, 'geo', 'events-distance-p1.xml']))
81
- FakeWeb.register_uri(:get, WEB_BASE + 'lat=40.71417&long=-74.00639&api_key=foo123&method=geo.getevents', :body => File.join([FIXTURES_BASE, 'geo', 'events-lat-long.xml']))
82
- FakeWeb.register_uri(:get, WEB_BASE + 'location=Spain&api_key=foo123&method=geo.gettopartists', :body => File.join([FIXTURES_BASE, 'geo', 'top_artists-p1.xml']))
83
- FakeWeb.register_uri(:get, WEB_BASE + 'location=Germany&api_key=foo123&method=geo.gettoptracks', :body => File.join([FIXTURES_BASE, 'geo', 'top_tracks-p1.xml']))
84
-
85
- # User
86
- register_fw('method=user.getplaylists&api_key=foo123&user=jnunemaker',
87
- 'user', 'playlists.xml')
88
- register_fw('user=jnunemaker&api_key=foo123&method=user.getweeklytrackchart',
89
- 'user', 'weeklytrackchart.xml')
90
- register_fw('user=jnunemaker&api_key=foo123&method=user.getweeklyartistchart',
91
- 'user', 'weeklyartistchart.xml')
92
- register_fw('user=jnunemaker&api_key=foo123&method=user.getweeklyalbumchart',
93
- 'user', 'weeklyalbumchart.xml')
94
- register_fw('user=jnunemaker&api_key=foo123&method=user.getevents',
95
- 'user', 'events.xml')
96
- register_fw('user=jnunemaker&period=overall&api_key=foo123&method=user.gettoptracks',
97
- 'user', 'toptracks.xml')
98
- register_fw('user=jnunemaker&api_key=foo123&method=user.gettoptags',
99
- 'user', 'toptags.xml')
100
- register_fw('user=jnunemaker&period=overall&api_key=foo123&method=user.gettopartists',
101
- 'user', 'topartists.xml')
102
- register_fw('user=jnunemaker&period=overall&api_key=foo123&method=user.gettopalbums',
103
- 'user', 'topalbums.xml')
104
- register_fw('user=jnunemaker&api_key=foo123&method=user.getneighbours',
105
- 'user', 'neighbours.xml')
106
- register_fw('user=jnunemaker&api_key=foo123&method=user.getfriends',
107
- 'user', 'friends.xml')
108
- register_fw('user=jnunemaker&api_key=foo123&method=user.getfriends&page=1',
109
- 'user', 'friends.xml')
110
- register_fw('user=jnunemaker&api_key=foo123&method=user.getrecenttracks',
111
- 'user', 'recenttracks.xml')
112
- register_fw('user=jnunemaker&api_key=foo123&method=user.getlovedtracks',
113
- 'user', 'lovedtracks.xml')
114
-
115
- # Album
116
- register_fw('artist=Carrie%20Underwood&album=Some%20Hearts&api_key=foo123&method=album.getinfo',
117
- 'album', 'info.xml')
118
- FakeWeb.register_uri(:post, WEB_BASE + 'api_key=foo123&method=album.addTags&sk=d580d57f32848f5dcf574d1ce18d78b2&tags=tag1%2Ctag2&api_sig=ab00d1e2baf1c820f889f604ca86535d',
119
- :body => File.join([FIXTURES_BASE, 'album', 'addtags.xml']))
120
-
121
- # Authentication
122
- register_fw('api_key=foo123&authToken=3cf8871e1ce17fbfad72d49007ec2aad&method=auth.getMobileSession&username=john&api_sig=6b9c4b9732a6bb0339bcbbc9ecbcd4dd',
123
- 'auth', 'mobile.xml')
124
- register_fw('api_key=foo123&method=auth.getToken&api_sig=1cc6b6f01a027f166a21ca8fe0c693b3',
125
- 'auth', 'token.xml')
126
- register_fw('api_key=foo123&method=auth.getSession&token=0e6af5cd2fff6b314994af5b0c58ecc1&api_sig=2f8e52b15b36e8ca1356e7337364b84b',
127
- 'auth', 'session.xml')
@@ -1,7 +0,0 @@
1
- require File.dirname(__FILE__) + '/../lib/scrobbler'
2
- require File.dirname(__FILE__) + '/mocks/rest'
3
-
4
- # To test the 2.0 API, we do not need a valid key but one must be set
5
- Scrobbler::Base.api_key = 'foo123'
6
- Scrobbler::Base.secret = 'bar456'
7
-
@@ -1,6 +0,0 @@
1
- require 'test/unit'
2
- require File.expand_path('../lib/scrobbler.rb', File.dirname(__FILE__))
3
- require File.dirname(__FILE__) + '/mocks/rest'
4
-
5
- # To test the 2.0 API, we do not need a valid key
6
- Scrobbler::Base.api_key = 'foo123'
@@ -1,61 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
2
-
3
- describe Scrobbler::Album do
4
-
5
- before(:each) do
6
- @album = Scrobbler::Album.new(:name => 'Some Hearts', :artist => 'Carrie Underwood')
7
- @session = Scrobbler::Session.new(:name => 'john', :subscriber => false, :key => 'd580d57f32848f5dcf574d1ce18d78b2')
8
- end
9
-
10
- it 'should know the artist' do
11
- @album.artist.name.should eql('Carrie Underwood')
12
- end
13
-
14
- it "should know it's name" do
15
- @album.name.should eql('Some Hearts')
16
- end
17
-
18
- it "should implement all methods from the Last.fm 2.0 API" do
19
- @album.should respond_to(:add_tags)
20
- @album.should respond_to(:buylinks)
21
- @album.should respond_to(:load_info)
22
- @album.should respond_to(:tags)
23
- @album.should respond_to(:top_tags)
24
- @album.should respond_to(:remove_tag)
25
- @album.should respond_to(:search)
26
- @album.should respond_to(:share)
27
- end
28
-
29
- it 'should be able to add tags' do
30
- @album.add_tags(@session, ['tag1', 'tag2'])
31
- end
32
-
33
- it 'should be able to load album info' do
34
- @album.load_info
35
-
36
- @album.mbid.should eql('a33b9822-9f09-4e19-9d6e-e05af85c727b')
37
- @album.url.should eql('http://www.last.fm/music/Carrie+Underwood/Some+Hearts')
38
- @album.release_date.should eql(Time.mktime(2005, 11, 15, 00, 00, 00))
39
- @album.image(:small).should eql('http://userserve-ak.last.fm/serve/34s/19874169.jpg')
40
- @album.image(:medium).should eql('http://userserve-ak.last.fm/serve/64s/19874169.jpg')
41
- @album.image(:large).should eql('http://userserve-ak.last.fm/serve/174s/19874169.jpg')
42
- @album.image(:extralarge).should eql('http://userserve-ak.last.fm/serve/300x300/19874169.jpg')
43
- @album.listeners.should eql(131312)
44
- @album.playcount.should eql(2096260)
45
- @album.top_tags.should be_kind_of(Array)
46
- @album.should have(5).top_tags
47
- @album.top_tags.first.should be_kind_of(Scrobbler::Tag)
48
- @album.top_tags.first.name.should eql('country')
49
- @album.top_tags.first.url.should eql('http://www.last.fm/tag/country')
50
- end
51
-
52
- it 'should be able to get the user\'s tags for this album'
53
-
54
- it 'should be able to remove tags'
55
-
56
- it 'should be able to search for albums'
57
-
58
- it 'should be able to get the links to buy this album'
59
-
60
- it 'should be able to share a album with a friend'
61
- end
@@ -1,132 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
4
-
5
- describe Scrobbler::Artist do
6
-
7
- before(:each) do
8
- @artist = Scrobbler::Artist.new(:name => 'Metallica')
9
- end
10
-
11
- it 'should know its name' do
12
- @artist.name.should eql('Metallica')
13
- end
14
-
15
- it 'should implement all methods from the Last.fm 2.0 API' do
16
- @artist.should respond_to(:add_tags)
17
- @artist.should respond_to(:events)
18
- @artist.should respond_to(:images)
19
- @artist.should respond_to(:load_info)
20
- @artist.should respond_to(:shouts)
21
- @artist.should respond_to(:similar)
22
- @artist.should respond_to(:tags)
23
- @artist.should respond_to(:top_albums)
24
- @artist.should respond_to(:top_fans)
25
- @artist.should respond_to(:top_tags)
26
- @artist.should respond_to(:top_tracks)
27
- @artist.should respond_to(:remove_tag)
28
- @artist.should respond_to(:search)
29
- @artist.should respond_to(:share)
30
- @artist.should respond_to(:shout)
31
- end
32
-
33
- it 'should be able to add tags'
34
-
35
- it 'should be able to load a list of upcoming events'
36
-
37
- it 'should be able to get images for this artist in a variety of sizes'
38
-
39
- it 'should be able to load the artist info' do
40
- @artist.load_info
41
- @artist.mbid.should eql('bfcc6d75-a6a5-4bc6-8282-47aec8531818')
42
- @artist.url.should eql('http://www.last.fm/music/Cher')
43
- @artist.image(:small).should eql('http://userserve-ak.last.fm/serve/34/9137697.jpg')
44
- @artist.image(:medium).should eql('http://userserve-ak.last.fm/serve/64/9137697.jpg')
45
- @artist.image(:large).should eql('http://userserve-ak.last.fm/serve/126/9137697.jpg')
46
- @artist.streamable.should be_true
47
- @artist.listeners.should eql(383775)
48
- @artist.playcount.should eql(3141583)
49
- end
50
-
51
- it 'should be able to get shouts for this artist'
52
-
53
- it 'should be able to get all the artists similar to this artist' do
54
- @artist.similar.should be_kind_of(Array)
55
- @artist.similar.should have(100).items
56
- @artist.similar.first.should be_kind_of(Scrobbler::Artist)
57
- @artist.similar.first.name.should eql('Megadeth')
58
- @artist.similar.first.mbid.should eql('a9044915-8be3-4c7e-b11f-9e2d2ea0a91e')
59
- @artist.similar.first.match.should eql(100)
60
- @artist.similar.first.url.should eql('www.last.fm/music/Megadeth')
61
- @artist.similar.first.image(:small).should eql('http://userserve-ak.last.fm/serve/34/8422011.jpg')
62
- @artist.similar.first.image(:medium).should eql('http://userserve-ak.last.fm/serve/64/8422011.jpg')
63
- @artist.similar.first.image(:large).should eql('http://userserve-ak.last.fm/serve/126/8422011.jpg')
64
- @artist.similar.first.image(:small).should eql('http://userserve-ak.last.fm/serve/34/8422011.jpg')
65
- @artist.similar.first.streamable.should be_true
66
- end
67
-
68
- it 'should be able to get the tags applied by a user'
69
-
70
- it 'should be able to get the top albums' do
71
- @artist.top_albums.should be_kind_of(Array)
72
- @artist.top_albums.should have(4).items
73
- @artist.top_albums.first.should be_kind_of(Scrobbler::Album)
74
- @artist.top_albums.first.name.should eql('Master of Puppets')
75
- @artist.top_albums.first.playcount.should eql(1165854)
76
- @artist.top_albums.first.mbid.should eql('fed37cfc-2a6d-4569-9ac0-501a7c7598eb')
77
- @artist.top_albums.first.url.should eql('http://www.last.fm/music/Metallica/Master+of+Puppets')
78
- @artist.top_albums.first.artist.should be_kind_of(Scrobbler::Artist)
79
- @artist.top_albums.first.artist.name.should eql('Metallica')
80
- @artist.top_albums.first.artist.mbid.should eql('65f4f0c5-ef9e-490c-aee3-909e7ae6b2ab')
81
- @artist.top_albums.first.artist.url.should eql('http://www.last.fm/music/Metallica')
82
- @artist.top_albums.first.image(:small).should eql('http://userserve-ak.last.fm/serve/34s/8622967.jpg')
83
- @artist.top_albums.first.image(:medium).should eql('http://userserve-ak.last.fm/serve/64s/8622967.jpg')
84
- @artist.top_albums.first.image(:large).should eql('http://userserve-ak.last.fm/serve/126/8622967.jpg')
85
- end
86
-
87
- it 'should be able to get the top fans' do
88
- @artist.top_fans.should be_kind_of(Array)
89
- @artist.top_fans.should have(6).items
90
- @artist.top_fans.first.should be_kind_of(Scrobbler::User)
91
- @artist.top_fans.first.name.should eql('Slide15')
92
- @artist.top_fans.first.url.should eql('http://www.last.fm/user/Slide15')
93
- @artist.top_fans.first.image(:small).should eql('http://userserve-ak.last.fm/serve/34/4477633.jpg')
94
- @artist.top_fans.first.image(:medium).should eql('http://userserve-ak.last.fm/serve/64/4477633.jpg')
95
- @artist.top_fans.first.image(:large).should eql('http://userserve-ak.last.fm/serve/126/4477633.jpg')
96
- @artist.top_fans.first.weight.should eql(265440672)
97
- end
98
-
99
- it 'should be able to get the top tags' do
100
- @artist.top_tags.should be_kind_of(Array)
101
- @artist.top_tags.should have(3).items
102
- @artist.top_tags.first.should be_kind_of(Scrobbler::Tag)
103
- @artist.top_tags.first.name.should eql('metal')
104
- @artist.top_tags.first.count.should eql(100)
105
- @artist.top_tags.first.url.should eql('http://www.last.fm/tag/metal')
106
- end
107
-
108
- it 'should be able to get the top tracks' do
109
- @artist.top_tracks.should be_kind_of(Array)
110
- @artist.top_tracks.should have(4).items
111
- @artist.top_tracks.first.should be_kind_of(Scrobbler::Track)
112
- @artist.top_tracks.first.rank.should eql(1.0)
113
- @artist.top_tracks.first.name.should eql('Nothing Else Matters')
114
- @artist.top_tracks.first.playcount.should eql(537704)
115
- @artist.top_tracks.first.mbid.should eql('')
116
- @artist.top_tracks.first.url.should eql('http://www.last.fm/music/Metallica/_/Nothing+Else+Matters')
117
- @artist.top_tracks.first.artist.should be_kind_of(Scrobbler::Artist)
118
- @artist.top_tracks.first.artist.name.should eql('Metallica')
119
- @artist.top_tracks.first.artist.url.should eql('http://www.last.fm/music/Metallica')
120
- @artist.top_tracks.first.artist.mbid.should eql('65f4f0c5-ef9e-490c-aee3-909e7ae6b2ab')
121
- @artist.top_tracks.first.image(:small).should eql('http://userserve-ak.last.fm/serve/34s/8622943.jpg')
122
- @artist.top_tracks.first.image(:medium).should eql('http://userserve-ak.last.fm/serve/64s/8622943.jpg')
123
- @artist.top_tracks.first.image(:large).should eql('http://userserve-ak.last.fm/serve/126/8622943.jpg')
124
- end
125
-
126
- it 'should be able to remove tags'
127
-
128
- it 'should be able to search for an artist'
129
-
130
- it 'should be able to leave a shout'
131
-
132
- end
@@ -1,51 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
2
-
3
- describe Scrobbler::Authentication do
4
-
5
- before(:each) do
6
- @auth = Scrobbler::Authentication.new(:username => 'john')
7
- end
8
-
9
- it 'should implement' do
10
- @auth.should respond_to(:session)
11
- @auth.should respond_to(:mobile_session)
12
- @auth.should respond_to(:token)
13
- end
14
-
15
- it 'should be able to authorize a mobile session' do
16
- @session = @auth.mobile_session('doe')
17
- @session.key.should eql('d580d57f32848f5dcf574d1ce18d78b2')
18
- @session.subscriber.should be_false
19
- @session.name.should eql('john')
20
- end
21
-
22
- it 'should be able to authorize a web session' do
23
- # Check URL generation
24
- session_url = @auth.webservice_session_url
25
- session_url.should match /http\:\/\/www.last.fm\/api\/auth\/\?api_key=[^&?]*/
26
- session_url_cb = @auth.webservice_session_url("http://www.example.com/callback")
27
- session_url_cb.should match /http\:\/\/www.last.fm\/api\/auth\/\?api_key=[^&?]*&cb=[^&?]*/
28
- # Handle callback -- mocking this --
29
- token = @auth.token
30
- # Check session generation
31
- @session = @auth.session(token)
32
- @session.key.should eql('d580d57f32848f5dcf574d1ce18d78b2')
33
- @session.subscriber.should be_false
34
- @session.name.should eql('john')
35
- end
36
-
37
- it 'should be able to authroize a desktop session' do
38
- # Check URL generation
39
- token = @auth.token
40
- session_url = @auth.desktop_session_url(token)
41
- session_url.should match /http\:\/\/www.last.fm\/api\/auth\/\?api_key=[^&?]*&token=[^&?]*/
42
- # -- Intemediate step needed in production to let the user grant this application access
43
- # Check session generation
44
- @session = @auth.session(token)
45
- @session.key.should eql('d580d57f32848f5dcf574d1ce18d78b2')
46
- @session.subscriber.should be_false
47
- @session.name.should eql('john')
48
- end
49
-
50
- end
51
-
@@ -1,105 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
2
-
3
- describe Scrobbler::Event do
4
-
5
- before(:all) do
6
- @event = Scrobbler::Event.new(:id => 328799)
7
- end
8
-
9
- it 'should know its id' do
10
- @event.id.should eql(328799)
11
- end
12
-
13
- describe 'should implement the Last.fm 2.0 API method' do
14
- [:attend, :attendees, :load_info, :shouts, :share, :shout].each do |method_name|
15
- it "'#{method_name}'" do
16
- @event.should respond_to(method_name)
17
- end
18
- end
19
- end
20
-
21
- it 'should set user\'s status for attendance'
22
-
23
- describe 'events attendees' do
24
- before do
25
- @attendees = ["ikea", "Schrollum", "Alpha1", "japps", "Gomhen", "NTG"]
26
- end
27
-
28
- it 'should have 6 attendees' do
29
- @event.attendees.size.should eql 6
30
- end
31
-
32
- it "should know it's attendees names" do
33
- @event.attendees.collect(&:name).should eql @attendees
34
- end
35
-
36
- describe 'first attendee' do
37
- before do
38
- @attendee = @event.attendees.first
39
- end
40
-
41
- it "should know it's realname" do
42
- @attendee.realname.should eql 'Jane'
43
- end
44
-
45
- it "should know it's small image" do
46
- @attendee.image(:small).should eql 'http://userserve-ak.last.fm/serve/34/17805805.jpg'
47
- end
48
-
49
- it "should know it's medium image" do
50
- @attendee.image(:medium).should eql 'http://userserve-ak.last.fm/serve/64/17805805.jpg'
51
- end
52
-
53
- it "should know it's large image" do
54
- @attendee.image(:large).should eql 'http://userserve-ak.last.fm/serve/126/17805805.jpg'
55
- end
56
-
57
- it "should know it's large url" do
58
- @attendee.url.should eql 'http://www.last.fm/user/ikea'
59
- end
60
- end
61
- end
62
-
63
- it 'should be able to load its info' do
64
- @event.load_info
65
- @event.title.should eql('Philip Glass')
66
- @event.artists.should be_kind_of(Array)
67
- @event.artists.first.should be_kind_of(Scrobbler::Artist)
68
- @event.artists.first.name.should eql('Philip Glass')
69
- @event.headliner.should be_kind_of(Scrobbler::Artist)
70
- @event.headliner.name.should eql('Philip Glass')
71
- @event.venue.should be_kind_of(Scrobbler::Venue)
72
- @event.venue.name.should eql('Barbican Centre')
73
- @event.venue.city.should eql('London')
74
- @event.venue.country.should eql('United Kingdom')
75
- @event.venue.street.should eql('Silk Street')
76
- @event.venue.postalcode.should eql('EC2Y 8DS')
77
- @event.venue.geo_lat.should eql('51.519972')
78
- @event.venue.geo_long.should eql('-0.09334')
79
- @event.venue.url.should eql('http://www.last.fm/venue/8777860')
80
- @event.start_date.should eql(Time.mktime(2008, 6, 12, 19, 30, 00))
81
- @event.description.should eql('Nunc vulputate, ante vitae sollicitudin ullamcorper, velit eros ultricies libero.')
82
- @event.image(:small).should eql('http://userserve-ak.last.fm/serve/34/320636.jpg')
83
- @event.image(:medium).should eql('http://userserve-ak.last.fm/serve/64/320636.jpg')
84
- @event.image(:large).should eql('http://userserve-ak.last.fm/serve/126/320636.jpg')
85
- @event.url.should eql('http://www.last.fm/event/328799')
86
- @event.attendance.should eql(46)
87
- @event.reviews.should eql(0)
88
- @event.tag.should eql('lastfm:event=328799')
89
- end
90
-
91
- it 'should be able to get its shouts' do
92
- @event.shouts.should be_kind_of(Array)
93
- @event.shouts.should have(6).items
94
- @event.shouts.first.should be_kind_of(Scrobbler::Shout)
95
- @event.shouts.first.body.should eql('test')
96
- @event.shouts.first.author.should be_kind_of(Scrobbler::User)
97
- @event.shouts.first.author.name.should eql('kaypey')
98
- @event.shouts.first.date.should eql(Time.mktime(2009, 4, 28, 5, 35, 11))
99
- end
100
-
101
- it 'should be able to be shared'
102
-
103
- it 'should be able to leave a shout'
104
-
105
- end