scrobbler-ng 2.0.0 → 2.0.1

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/test/mocks/rest.rb CHANGED
@@ -1,212 +1,114 @@
1
- require File.dirname(__FILE__) + '/../../lib/scrobbler/rest'
1
+ # encoding: utf-8
2
+
2
3
  require 'rubygems'
3
4
  require 'fakeweb'
4
- require 'digest/md5'
5
+ require File.expand_path('/../../lib/scrobbler/rest', File.dirname(__FILE__))
5
6
 
6
7
  FIXTURES_BASE = File.join([File.dirname(__FILE__), '..', 'fixtures', 'xml'])
8
+ WEB_BASE = 'http://ws.audioscrobbler.com:80/2.0/?'
7
9
  FakeWeb.allow_net_connect = false
8
10
 
11
+ def register_fw(uri, *args)
12
+ FakeWeb.register_uri(:get, WEB_BASE + uri,
13
+ :body => File.join([FIXTURES_BASE] + args))
14
+ end
15
+
9
16
  ## Library
10
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.getalbums&force=false&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'albums-p1.xml']))
11
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.getalbums&force=false&page=2&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'albums-p2.xml']))
12
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.getalbums&force=false&page=3&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'albums-p3.xml']))
13
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.getalbums&force=false&page=4&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'albums-p4.xml']))
14
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.getalbums&force=false&page=5&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'albums-p5.xml']))
15
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.getalbums&force=false&page=6&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'albums-p6.xml']))
16
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.getalbums&force=false&page=7&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'albums-p7.xml']))
17
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.getalbums&force=false&page=8&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'albums-p8.xml']))
18
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.getalbums&limit=30&force=false&api_key=foo123&user=xhochy&all=false', :body => File.join([FIXTURES_BASE, 'library', 'albums-f30.xml']))
19
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.getartists&force=false&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'artists-p1.xml']))
20
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.getartists&force=false&page=2&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'artists-p2.xml']))
21
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.getartists&force=false&page=3&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'artists-p3.xml']))
22
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.getartists&force=false&page=4&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'artists-p4.xml']))
23
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.getartists&force=false&page=5&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'artists-p5.xml']))
24
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.getartists&force=false&page=6&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'artists-p6.xml']))
25
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.getartists&force=false&page=7&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'artists-p7.xml']))
26
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.getartists&limit=30&force=false&api_key=foo123&user=xhochy&all=false', :body => File.join([FIXTURES_BASE, 'library', 'artists-f30.xml']))
27
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p1.xml']))
28
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=2&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p2.xml']))
29
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=3&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p3.xml']))
30
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=4&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p4.xml']))
31
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=5&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p5.xml']))
32
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=6&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p6.xml']))
33
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=7&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p7.xml']))
34
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=8&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p8.xml']))
35
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=9&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p9.xml']))
36
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=10&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p10.xml']))
37
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=11&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p11.xml']))
38
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=12&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p12.xml']))
39
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=13&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p13.xml']))
40
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=14&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p14.xml']))
41
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=15&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p15.xml']))
42
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=16&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p16.xml']))
43
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=17&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p17.xml']))
44
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=18&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p18.xml']))
45
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=19&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p19.xml']))
46
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=20&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p20.xml']))
47
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=21&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p21.xml']))
48
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=22&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p22.xml']))
49
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=23&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p23.xml']))
50
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=24&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p24.xml']))
51
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=25&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p25.xml']))
52
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=26&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p26.xml']))
53
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=27&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p27.xml']))
54
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=28&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p28.xml']))
55
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=29&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p29.xml']))
56
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=30&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p30.xml']))
57
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=31&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p31.xml']))
58
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=32&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p32.xml']))
59
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=33&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p33.xml']))
60
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&force=false&page=34&api_key=foo123&user=xhochy&all=true', :body => File.join([FIXTURES_BASE, 'library', 'tracks-p34.xml']))
61
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=library.gettracks&limit=30&force=false&api_key=foo123&user=xhochy&all=false', :body => File.join([FIXTURES_BASE, 'library', 'tracks-f30.xml']))
17
+ require File.expand_path('library.rb', File.dirname(__FILE__))
62
18
 
63
19
  ## Event
64
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=event.getattendees&event=328799&api_key=foo123', :body => File.join([FIXTURES_BASE, 'event', 'attendees.xml']))
65
- FakeWeb.register_uri(:post, 'http://ws.audioscrobbler.com:80/2.0/?api_key=foo123&event=328799&method=event.attend&sk=d580d57f32848f5dcf574d1ce18d78b2&status=1&api_sig=c476ec753082205327b0f6ef922d82c8', :body => File.join([FIXTURES_BASE, 'event', 'attend.xml']))
66
-
20
+ register_fw('method=event.getattendees&event=328799&api_key=foo123',
21
+ 'event', 'attendees.xml')
22
+ register_fw('event=328799&api_key=foo123&method=event.getshouts',
23
+ 'event', 'shouts.xml')
24
+ register_fw('event=328799&api_key=foo123&method=event.getinfo',
25
+ 'event', 'event.xml')
26
+ FakeWeb.register_uri(:post, WEB_BASE + 'api_key=foo123&event=328799&method=event.attend&sk=d580d57f32848f5dcf574d1ce18d78b2&status=1&api_sig=c476ec753082205327b0f6ef922d82c8',
27
+ :body => File.join([FIXTURES_BASE, 'event', 'attend.xml']))
67
28
 
68
29
  ## Tag
69
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=tag.gettoptags&api_key=foo123', :body => File.join([FIXTURES_BASE, 'tag', 'toptags.xml']))
70
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=tag.getsimilar&tag=rock&api_key=foo123', :body => File.join([FIXTURES_BASE, 'tag', 'similar.xml']))
30
+ register_fw('tag=rock&api_key=foo123&method=tag.gettoptracks',
31
+ 'tag', 'toptracks.xml')
32
+ register_fw('method=tag.gettoptags&api_key=foo123',
33
+ 'tag', 'toptags.xml')
34
+ register_fw('method=tag.getsimilar&tag=rock&api_key=foo123',
35
+ 'tag', 'similar.xml')
36
+ register_fw('tag=rock&api_key=foo123&method=tag.gettopartists',
37
+ 'tag', 'topartists.xml')
38
+ register_fw('tag=rock&api_key=foo123&method=tag.gettopalbums',
39
+ 'tag', 'topalbums.xml')
71
40
 
72
41
  ## Venue
73
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=venue.getevents&api_key=foo123&venue=9027137', :body => File.join([FIXTURES_BASE, 'venue', 'events.xml']))
74
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=venue.getpastevents&api_key=foo123&venue=9027137', :body => File.join([FIXTURES_BASE, 'venue', 'events.xml']))
42
+ register_fw('method=venue.getevents&api_key=foo123&venue=9027137',
43
+ 'venue', 'events.xml')
44
+ register_fw('method=venue.getpastevents&api_key=foo123&venue=9027137',
45
+ 'venue', 'events.xml')
75
46
 
76
47
  ## Auth
77
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?api_key=foo123&method=auth.gettoken&api_sig=d062b3b3fa109d048732819d27d04689', :body => File.join([FIXTURES_BASE, 'auth', 'token.xml']))
78
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?api_key=foo123&method=auth.getsession&token=test123token&api_sig=f4a839c10a010368bd1058725c253dfb', :body => File.join([FIXTURES_BASE, 'auth', 'session.xml']))
48
+ register_fw('api_key=foo123&method=auth.gettoken&api_sig=d062b3b3fa109d048732819d27d04689',
49
+ 'auth', 'token.xml')
50
+ register_fw('api_key=foo123&method=auth.getsession&token=test123token&api_sig=f4a839c10a010368bd1058725c253dfb',
51
+ 'auth', 'session.xml')
79
52
 
80
53
  ## Artist
81
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?artist=Metallica&method=artist.getinfo&api_key=foo123', :body => File.join([FIXTURES_BASE, 'artist', 'info.xml']))
54
+ register_fw('artist=Metallica&method=artist.getinfo&api_key=foo123',
55
+ 'artist', 'info.xml')
56
+ register_fw('artist=Metallica&api_key=foo123&method=artist.gettoptags',
57
+ 'artist', 'toptags.xml')
58
+ register_fw('artist=Metallica&api_key=foo123&method=artist.gettopfans',
59
+ 'artist', 'fans.xml')
60
+ register_fw('artist=Metallica&api_key=foo123&method=artist.gettopalbums',
61
+ 'artist', 'topalbums.xml')
62
+ register_fw('artist=Metallica&api_key=foo123&method=artist.getsimilar',
63
+ 'artist', 'similar.xml')
64
+ register_fw('artist=Metallica&api_key=foo123&method=artist.gettoptracks',
65
+ 'artist', 'toptracks.xml')
82
66
 
83
67
  ## Track
84
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?api_key=foo123&method=track.getinfo&artist=Carrie%20Underwood&track=Before%20He%20Cheats', :body => File.join([FIXTURES_BASE, 'track', 'info.xml']))
85
-
68
+ register_fw('api_key=foo123&method=track.getinfo&artist=Carrie%20Underwood&track=Before%20He%20Cheats',
69
+ 'track', 'info.xml')
70
+ register_fw('artist=Cher&track=Before%20He%20Cheats&api_key=foo123&method=track.gettopfans',
71
+ 'track', 'fans.xml')
72
+ register_fw('artist=Cher&track=Before%20He%20Cheats&api_key=foo123&method=track.gettoptags',
73
+ 'track', 'toptags.xml')
86
74
 
87
75
  ## Geo
88
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=geo.getevents&api_key=foo123&page=1&force=false&location=Manchester', :body => File.join([FIXTURES_BASE, 'geo', 'events-p1.xml']))
89
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=geo.getevents&api_key=foo123&page=2&force=false&location=Manchester', :body => File.join([FIXTURES_BASE, 'geo', 'events-p2.xml']))
90
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=geo.getevents&api_key=foo123&page=3&force=false&location=Manchester', :body => File.join([FIXTURES_BASE, 'geo', 'events-p3.xml']))
91
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?distance=15&method=geo.getevents&api_key=foo123&page=1&force=false', :body => File.join([FIXTURES_BASE, 'geo', 'events-distance-p1.xml']))
92
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?long=-74.00639&method=geo.getevents&api_key=foo123&page=1&lat=40.71417&force=false', :body => File.join([FIXTURES_BASE, 'geo', 'events-lat-long.xml']))
93
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=geo.gettopartists&api_key=foo123&page=1&force=false&location=Spain', :body => File.join([FIXTURES_BASE, 'geo', 'top_artists-p1.xml']))
94
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=geo.gettoptracks&api_key=foo123&page=1&force=false&location=Germany', :body => File.join([FIXTURES_BASE, 'geo', 'top_tracks-p1.xml']))
76
+ FakeWeb.register_uri(:get, WEB_BASE + 'location=Manchester&api_key=foo123&method=geo.getevents', :body => File.join([FIXTURES_BASE, 'geo', 'events-p1.xml']))
77
+ 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']))
78
+ 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']))
79
+ FakeWeb.register_uri(:get, WEB_BASE + 'distance=15&api_key=foo123&method=geo.getevents', :body => File.join([FIXTURES_BASE, 'geo', 'events-distance-p1.xml']))
80
+ 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']))
81
+ FakeWeb.register_uri(:get, WEB_BASE + 'location=Spain&api_key=foo123&method=geo.gettopartists', :body => File.join([FIXTURES_BASE, 'geo', 'top_artists-p1.xml']))
82
+ FakeWeb.register_uri(:get, WEB_BASE + 'location=Germany&api_key=foo123&method=geo.gettoptracks', :body => File.join([FIXTURES_BASE, 'geo', 'top_tracks-p1.xml']))
95
83
 
96
84
  # User
97
- FakeWeb.register_uri(:get, 'http://ws.audioscrobbler.com:80/2.0/?method=user.getplaylists&api_key=foo123&user=jnunemaker', :body => File.join([FIXTURES_BASE, 'user', 'playlists.xml']))
98
-
99
-
100
-
101
- module Scrobbler
102
- module REST
103
- class Connection
104
- alias :old_request :request
105
- # reads xml fixture file instead of hitting up the internets
106
- def request(resource, method = "get", args = nil)
107
-
108
- @now_playing_url = 'http://62.216.251.203:80/nowplaying'
109
- @submission_url = 'http://62.216.251.205:80/protocol_1.2'
110
- @session_id = '17E61E13454CDD8B68E8D7DEEEDF6170'
111
-
112
- if @base_url == Scrobbler::API_URL
113
- pieces = resource.split('/')
114
- pieces.shift
115
- api_version = pieces.shift
116
- if api_version == "1.0"
117
- folder = pieces.shift
118
- file = pieces.last[0, pieces.last.index('.xml')]
119
- base_pieces = pieces.last.split('?')
120
-
121
- file = if base_pieces.size > 1
122
- # if query string params are in resource they are underscore separated for filenames
123
- base_pieces.last.split('&').inject("#{file}_") { |str, pair| str << pair.split('=').join('_') + '_'; str }.chop!
124
- else
125
- file
126
- end
127
-
128
- File.read(File.dirname(__FILE__) + "/../fixtures/xml/#{folder}/#{file}.xml")
129
- elsif api_version == "2.0"
130
- method_pieces = pieces.last.split('&')
131
- api_method = method_pieces.shift
132
- if api_method == '?method=artist.search'
133
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/search/artist.xml")
134
- elsif api_method == '?method=album.search'
135
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/search/album.xml")
136
- elsif api_method == '?method=track.search'
137
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/search/track.xml")
138
- elsif pieces.last =~ /[?&]method=album\.getinfo/
139
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/album/info.xml")
140
- elsif pieces.last =~ /[?&]method=artist\.gettoptags/
141
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/artist/toptags.xml")
142
- elsif pieces.last =~ /[?&]method=artist\.gettopfans/
143
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/artist/fans.xml")
144
- elsif pieces.last =~ /[?&]method=artist\.gettoptracks/
145
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/artist/toptracks.xml")
146
- elsif pieces.last =~ /[?&]method=artist\.gettopalbums/
147
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/artist/topalbums.xml")
148
- elsif pieces.last =~ /[?&]method=artist\.getsimilar/
149
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/artist/similar.xml")
150
- elsif pieces.last =~ /[?&]method=tag\.gettoptracks/
151
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/tag/toptracks.xml")
152
- elsif pieces.last =~ /[?&]method=tag\.gettopartists/
153
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/tag/topartists.xml")
154
- elsif pieces.last =~ /[?&]method=tag\.gettopalbums/
155
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/tag/topalbums.xml")
156
- elsif pieces.last =~ /[?&]method=track\.gettoptags/
157
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/track/toptags.xml")
158
- elsif pieces.last =~ /[?&]method=track\.gettopfans/
159
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/track/fans.xml")
160
- elsif pieces.last =~ /[?&]method=user\.getlovedtracks/
161
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/user/lovedtracks.xml")
162
- elsif pieces.last =~ /[?&]method=user\.gettopartists/
163
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/user/topartists.xml")
164
- elsif pieces.last =~ /[?&]method=user\.gettopalbums/
165
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/user/topalbums.xml")
166
- elsif pieces.last =~ /[?&]method=user\.gettoptracks/
167
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/user/toptracks.xml")
168
- elsif pieces.last =~ /[?&]method=user\.getfriends/
169
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/user/friends.xml")
170
- elsif pieces.last =~ /[?&]method=user\.gettoptags/
171
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/user/toptags.xml")
172
- elsif pieces.last =~ /[?&]method=user\.getneighbours/
173
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/user/neighbours.xml")
174
- elsif pieces.last =~ /[?&]method=user\.getrecenttracks/
175
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/user/recenttracks.xml")
176
- elsif pieces.last =~ /[?&]method=event\.getinfo/
177
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/event/event.xml")
178
- elsif pieces.last =~ /[?&]method=event\.getshouts/
179
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/event/shouts.xml")
180
- elsif pieces.last =~ /[?&]method=user\.getweeklyalbumchart/
181
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/user/weeklyalbumchart.xml")
182
- elsif pieces.last =~ /[?&]method=user\.getweeklyartistchart/
183
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/user/weeklyartistchart.xml")
184
- elsif pieces.last =~ /[?&]method=user\.getweeklytrackchart/
185
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/user/weeklytrackchart.xml")
186
- elsif pieces.last =~ /[?&]method=user\.getevents/
187
- return File.read(File.dirname(__FILE__) + "/../fixtures/xml/user/events.xml")
188
- else
189
- old_request(resource, method, args)
190
- end
191
- end
192
- elsif @base_url == Scrobbler::AUTH_URL
193
- if args[:hs] == "true" && args[:p] == Scrobbler::AUTH_VER.to_s && args[:c] == 'rbs' &&
194
- args[:v] == '0.2.13' && args[:u] == 'chunky' && !args[:t].blank? &&
195
- args[:a] == Digest::MD5.hexdigest('7813258ef8c6b632dde8cc80f6bda62f' + args[:t])
196
-
197
- "OK\n#{@session_id}\n#{@now_playing_url}\n#{@submission_url}"
198
- end
199
- elsif @base_url == @now_playing_url
200
- if args[:s] == @session_id && ![args[:a], args[:t], args[:b], args[:n]].any?(&:blank?)
201
- 'OK'
202
- end
203
- elsif @base_url == @submission_url
204
- if args[:s] == @session_id &&
205
- ![args['a[0]'], args['t[0]'], args['i[0]'], args['o[0]'], args['l[0]'], args['b[0]']].any?(&:blank?)
206
- 'OK'
207
- end
208
- end
209
- end
210
- end
211
- end
212
- end
85
+ register_fw('method=user.getplaylists&api_key=foo123&user=jnunemaker',
86
+ 'user', 'playlists.xml')
87
+ register_fw('user=jnunemaker&api_key=foo123&method=user.getweeklytrackchart',
88
+ 'user', 'weeklytrackchart.xml')
89
+ register_fw('user=jnunemaker&api_key=foo123&method=user.getweeklyartistchart',
90
+ 'user', 'weeklyartistchart.xml')
91
+ register_fw('user=jnunemaker&api_key=foo123&method=user.getweeklyalbumchart',
92
+ 'user', 'weeklyalbumchart.xml')
93
+ register_fw('user=jnunemaker&api_key=foo123&method=user.getevents',
94
+ 'user', 'events.xml')
95
+ register_fw('user=jnunemaker&period=overall&api_key=foo123&method=user.gettoptracks',
96
+ 'user', 'toptracks.xml')
97
+ register_fw('user=jnunemaker&api_key=foo123&method=user.gettoptags',
98
+ 'user', 'toptags.xml')
99
+ register_fw('user=jnunemaker&period=overall&api_key=foo123&method=user.gettopartists',
100
+ 'user', 'topartists.xml')
101
+ register_fw('user=jnunemaker&period=overall&api_key=foo123&method=user.gettopalbums',
102
+ 'user', 'topalbums.xml')
103
+ register_fw('user=jnunemaker&api_key=foo123&method=user.getneighbours',
104
+ 'user', 'neighbours.xml')
105
+ register_fw('user=jnunemaker&page=1&limit=50&api_key=foo123&method=user.getfriends',
106
+ 'user', 'friends.xml')
107
+ register_fw('user=jnunemaker&api_key=foo123&method=user.getrecenttracks',
108
+ 'user', 'recenttracks.xml')
109
+ register_fw('user=jnunemaker&api_key=foo123&method=user.getlovedtracks',
110
+ 'user', 'lovedtracks.xml')
111
+
112
+ # Album
113
+ register_fw('artist=Carrie%20Underwood&album=Some%20Hearts&api_key=foo123&method=album.getinfo',
114
+ 'album', 'info.xml')
data/test/test_helper.rb CHANGED
@@ -1,20 +1,6 @@
1
1
  require 'test/unit'
2
- require File.dirname(__FILE__) + '/../lib/scrobbler'
2
+ require File.expand_path('../lib/scrobbler.rb', File.dirname(__FILE__))
3
3
  require File.dirname(__FILE__) + '/mocks/rest'
4
4
 
5
5
  # To test the 2.0 API, we do not need a valid key
6
- Scrobbler::Base.api_key = 'foo123'
7
-
8
- class << Test::Unit::TestCase
9
- def test(name, &block)
10
- test_name = :"test_#{name.gsub(' ','_')}"
11
- raise ArgumentError, "#{test_name} is already defined" if self.instance_methods.include? test_name.to_s
12
- define_method test_name, &block
13
- end
14
-
15
- def expect(expected_value, &block)
16
- define_method :"test_#{caller.first.split("/").last}" do
17
- assert_equal expected_value, instance_eval(&block)
18
- end
19
- end
20
- end
6
+ Scrobbler::Base.api_key = 'foo123'
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../spec_helper.rb'
3
3
  describe Scrobbler::Album do
4
4
 
5
5
  before(:each) do
6
- @album = Scrobbler::Album.new('Some Hearts', :artist=>'Carrie Underwood')
6
+ @album = Scrobbler::Album.new(:name => 'Some Hearts', :artist => 'Carrie Underwood')
7
7
  end
8
8
 
9
9
  it 'should know the artist' do
@@ -1,9 +1,11 @@
1
+ # encoding: utf-8
2
+
1
3
  require File.dirname(__FILE__) + '/../spec_helper.rb'
2
4
 
3
5
  describe Scrobbler::Artist do
4
6
 
5
7
  before(:each) do
6
- @artist = Scrobbler::Artist.new('Metallica')
8
+ @artist = Scrobbler::Artist.new(:name => 'Metallica')
7
9
  end
8
10
 
9
11
  it 'should know its name' do
@@ -86,7 +88,7 @@ describe Scrobbler::Artist do
86
88
  @artist.top_fans.should be_kind_of(Array)
87
89
  @artist.top_fans.should have(6).items
88
90
  @artist.top_fans.first.should be_kind_of(Scrobbler::User)
89
- @artist.top_fans.first.username.should eql('Slide15')
91
+ @artist.top_fans.first.name.should eql('Slide15')
90
92
  @artist.top_fans.first.url.should eql('http://www.last.fm/user/Slide15')
91
93
  @artist.top_fans.first.image(:small).should eql('http://userserve-ak.last.fm/serve/34/4477633.jpg')
92
94
  @artist.top_fans.first.image(:medium).should eql('http://userserve-ak.last.fm/serve/64/4477633.jpg')
@@ -5,7 +5,7 @@ describe Scrobbler::Event do
5
5
  before(:all) do
6
6
  @auth = Scrobbler::Auth.new('user')
7
7
  @session = @auth.session('test123token')
8
- @event = Scrobbler::Event.new(328799)
8
+ @event = Scrobbler::Event.new(:id => 328799)
9
9
  end
10
10
 
11
11
  it 'should know its id' do
@@ -98,7 +98,7 @@ describe Scrobbler::Event do
98
98
  @event.shouts.first.should be_kind_of(Scrobbler::Shout)
99
99
  @event.shouts.first.body.should eql('test')
100
100
  @event.shouts.first.author.should be_kind_of(Scrobbler::User)
101
- @event.shouts.first.author.username.should eql('kaypey')
101
+ @event.shouts.first.author.name.should eql('kaypey')
102
102
  @event.shouts.first.date.should eql(Time.mktime(2009, 4, 28, 5, 35, 11))
103
103
  end
104
104
 
@@ -29,105 +29,105 @@ describe Scrobbler::Library do
29
29
  it 'should be able to get its albums' do
30
30
  @library.should have(396).albums
31
31
  first = @library.albums.first
32
- first.should be_kind_of Scrobbler::Album
33
- first.name.should eql 'Silent Alarm'
34
- first.playcount.should eql 1043
35
- first.tagcount.should eql 0
36
- first.mbid.should eql '7e18e965-cbc7-43d6-9042-daba4f984a34'
37
- first.url.should eql 'http://www.last.fm/music/Bloc+Party/Silent+Alarm'
38
- first.artist.should be_kind_of Scrobbler::Artist
39
- first.artist.name.should eql 'Bloc Party'
40
- first.artist.mbid.should eql '8c538f11-c141-4588-8ecb-931083524186'
41
- first.artist.url.should eql 'http://www.last.fm/music/Bloc+Party'
42
- first.image(:small).should eql 'http://userserve-ak.last.fm/serve/34s/9903887.jpg'
43
- first.image(:medium).should eql 'http://userserve-ak.last.fm/serve/64s/9903887.jpg'
44
- first.image(:large).should eql 'http://userserve-ak.last.fm/serve/126/9903887.jpg'
32
+ first.should be_kind_of(Scrobbler::Album)
33
+ first.name.should ==('Silent Alarm')
34
+ first.playcount.should ==(1043)
35
+ first.tagcount.should ==(0)
36
+ first.mbid.should ==('7e18e965-cbc7-43d6-9042-daba4f984a34')
37
+ first.url.should ==('http://www.last.fm/music/Bloc+Party/Silent+Alarm')
38
+ first.artist.should be_kind_of(Scrobbler::Artist)
39
+ first.artist.name.should ==('Bloc Party')
40
+ first.artist.mbid.should ==('8c538f11-c141-4588-8ecb-931083524186')
41
+ first.artist.url.should ==('http://www.last.fm/music/Bloc+Party')
42
+ first.image(:small).should ==('http://userserve-ak.last.fm/serve/34s/9903887.jpg')
43
+ first.image(:medium).should ==('http://userserve-ak.last.fm/serve/64s/9903887.jpg')
44
+ first.image(:large).should ==('http://userserve-ak.last.fm/serve/126/9903887.jpg')
45
45
  end
46
46
 
47
47
  it 'should be able to get its 30 most heard albums' do
48
48
  @library.albums(:all => false, :limit => 30).should have(30).items
49
49
  first = @library.albums(:all => false, :limit => 30).first
50
- first.should be_kind_of Scrobbler::Album
51
- first.name.should eql 'Silent Alarm'
52
- first.playcount.should eql 1043
53
- first.tagcount.should eql 0
54
- first.mbid.should eql '7e18e965-cbc7-43d6-9042-daba4f984a34'
55
- first.url.should eql 'http://www.last.fm/music/Bloc+Party/Silent+Alarm'
56
- first.artist.should be_kind_of Scrobbler::Artist
57
- first.artist.name.should eql 'Bloc Party'
58
- first.artist.mbid.should eql '8c538f11-c141-4588-8ecb-931083524186'
59
- first.artist.url.should eql 'http://www.last.fm/music/Bloc+Party'
60
- first.image(:small).should eql 'http://userserve-ak.last.fm/serve/34s/9903887.jpg'
61
- first.image(:medium).should eql 'http://userserve-ak.last.fm/serve/64s/9903887.jpg'
62
- first.image(:large).should eql 'http://userserve-ak.last.fm/serve/126/9903887.jpg'
50
+ first.should be_kind_of(Scrobbler::Album)
51
+ first.name.should ==('Silent Alarm')
52
+ first.playcount.should ==(1043)
53
+ first.tagcount.should ==(0)
54
+ first.mbid.should ==('7e18e965-cbc7-43d6-9042-daba4f984a34')
55
+ first.url.should ==('http://www.last.fm/music/Bloc+Party/Silent+Alarm')
56
+ first.artist.should be_kind_of(Scrobbler::Artist)
57
+ first.artist.name.should ==('Bloc Party')
58
+ first.artist.mbid.should ==('8c538f11-c141-4588-8ecb-931083524186')
59
+ first.artist.url.should ==('http://www.last.fm/music/Bloc+Party')
60
+ first.image(:small).should ==('http://userserve-ak.last.fm/serve/34s/9903887.jpg')
61
+ first.image(:medium).should ==('http://userserve-ak.last.fm/serve/64s/9903887.jpg')
62
+ first.image(:large).should ==('http://userserve-ak.last.fm/serve/126/9903887.jpg')
63
63
  end
64
64
 
65
65
  it 'should be able to get its artists' do
66
66
  @library.should have(340).artists
67
67
  first = @library.artists.first
68
- first.should be_kind_of Scrobbler::Artist
69
- first.name.should eql 'Bloc Party'
70
- first.playcount.should eql 2314
71
- first.tagcount.should eql 0
72
- first.mbid.should eql '8c538f11-c141-4588-8ecb-931083524186'
73
- first.url.should eql 'http://www.last.fm/music/Bloc+Party'
68
+ first.should be_kind_of(Scrobbler::Artist)
69
+ first.name.should ==('Bloc Party')
70
+ first.playcount.should ==(2314)
71
+ first.tagcount.should ==(0)
72
+ first.mbid.should ==('8c538f11-c141-4588-8ecb-931083524186')
73
+ first.url.should ==('http://www.last.fm/music/Bloc+Party')
74
74
  first.streamable.should be_true
75
- first.image(:small).should eql 'http://userserve-ak.last.fm/serve/34/115908.jpg'
76
- first.image(:medium).should eql 'http://userserve-ak.last.fm/serve/64/115908.jpg'
77
- first.image(:large).should eql 'http://userserve-ak.last.fm/serve/126/115908.jpg'
75
+ first.image(:small).should ==('http://userserve-ak.last.fm/serve/34/115908.jpg')
76
+ first.image(:medium).should ==('http://userserve-ak.last.fm/serve/64/115908.jpg')
77
+ first.image(:large).should ==('http://userserve-ak.last.fm/serve/126/115908.jpg')
78
78
  end
79
79
 
80
80
  it 'should be able to get its 30 most heard artists' do
81
81
  @library.artists(:all => false, :limit => 30).should have(30).items
82
82
  first = @library.artists(:all => false, :limit => 30).first
83
- first.should be_kind_of Scrobbler::Artist
84
- first.name.should eql 'Bloc Party'
85
- first.playcount.should eql 2314
86
- first.tagcount.should eql 0
87
- first.mbid.should eql '8c538f11-c141-4588-8ecb-931083524186'
88
- first.url.should eql 'http://www.last.fm/music/Bloc+Party'
83
+ first.should be_kind_of(Scrobbler::Artist)
84
+ first.name.should ==('Bloc Party')
85
+ first.playcount.should ==(2314)
86
+ first.tagcount.should ==(0)
87
+ first.mbid.should ==('8c538f11-c141-4588-8ecb-931083524186')
88
+ first.url.should ==('http://www.last.fm/music/Bloc+Party')
89
89
  first.streamable.should be_true
90
- first.image(:small).should eql 'http://userserve-ak.last.fm/serve/34/115908.jpg'
91
- first.image(:medium).should eql 'http://userserve-ak.last.fm/serve/64/115908.jpg'
92
- first.image(:large).should eql 'http://userserve-ak.last.fm/serve/126/115908.jpg'
90
+ first.image(:small).should ==('http://userserve-ak.last.fm/serve/34/115908.jpg')
91
+ first.image(:medium).should ==('http://userserve-ak.last.fm/serve/64/115908.jpg')
92
+ first.image(:large).should ==('http://userserve-ak.last.fm/serve/126/115908.jpg')
93
93
  end
94
94
 
95
95
  it 'should be able to get its tracks' do
96
96
  @library.should have(1686).tracks
97
97
  first = @library.tracks.first
98
- first.should be_kind_of Scrobbler::Track
99
- first.name.should eql 'A-Punk'
100
- first.playcount.should eql 185
101
- first.tagcount.should eql 0
102
- first.mbid.should eql ''
103
- first.url.should eql 'http://www.last.fm/music/Vampire+Weekend/_/A-Punk'
98
+ first.should be_kind_of(Scrobbler::Track)
99
+ first.name.should ==('A-Punk')
100
+ first.playcount.should ==(185)
101
+ first.tagcount.should ==(0)
102
+ first.mbid.should ==('')
103
+ first.url.should ==('http://www.last.fm/music/Vampire+Weekend/_/A-Punk')
104
104
  first.streamable.should be_false
105
- first.artist.should be_kind_of Scrobbler::Artist
106
- first.artist.name.should eql 'Vampire Weekend'
107
- first.artist.mbid.should eql 'af37c51c-0790-4a29-b995-456f98a6b8c9'
108
- first.artist.url.should eql 'http://www.last.fm/music/Vampire+Weekend'
109
- first.image(:small).should eql 'http://userserve-ak.last.fm/serve/34s/10258165.jpg'
110
- first.image(:medium).should eql 'http://userserve-ak.last.fm/serve/64s/10258165.jpg'
111
- first.image(:large).should eql 'http://userserve-ak.last.fm/serve/126/10258165.jpg'
105
+ first.artist.should be_kind_of(Scrobbler::Artist)
106
+ first.artist.name.should ==('Vampire Weekend')
107
+ first.artist.mbid.should ==('af37c51c-0790-4a29-b995-456f98a6b8c9')
108
+ first.artist.url.should ==('http://www.last.fm/music/Vampire+Weekend')
109
+ first.image(:small).should ==('http://userserve-ak.last.fm/serve/34s/10258165.jpg')
110
+ first.image(:medium).should ==('http://userserve-ak.last.fm/serve/64s/10258165.jpg')
111
+ first.image(:large).should ==('http://userserve-ak.last.fm/serve/126/10258165.jpg')
112
112
  end
113
113
 
114
114
  it 'should be able to get its 30 most heard tracks' do
115
115
  @library.tracks(:all => false, :limit => 30).should have(30).items
116
116
  first = @library.tracks(:all => false, :limit => 30).first
117
- first.should be_kind_of Scrobbler::Track
118
- first.name.should eql 'A-Punk'
119
- first.playcount.should eql 185
120
- first.tagcount.should eql 0
121
- first.mbid.should eql ''
122
- first.url.should eql 'http://www.last.fm/music/Vampire+Weekend/_/A-Punk'
117
+ first.should be_kind_of(Scrobbler::Track)
118
+ first.name.should ==('A-Punk')
119
+ first.playcount.should ==(185)
120
+ first.tagcount.should ==(0)
121
+ first.mbid.should ==('')
122
+ first.url.should ==('http://www.last.fm/music/Vampire+Weekend/_/A-Punk')
123
123
  first.streamable.should be_false
124
- first.artist.should be_kind_of Scrobbler::Artist
125
- first.artist.name.should eql 'Vampire Weekend'
126
- first.artist.mbid.should eql 'af37c51c-0790-4a29-b995-456f98a6b8c9'
127
- first.artist.url.should eql 'http://www.last.fm/music/Vampire+Weekend'
128
- first.image(:small).should eql 'http://userserve-ak.last.fm/serve/34s/10258165.jpg'
129
- first.image(:medium).should eql 'http://userserve-ak.last.fm/serve/64s/10258165.jpg'
130
- first.image(:large).should eql 'http://userserve-ak.last.fm/serve/126/10258165.jpg'
124
+ first.artist.should be_kind_of(Scrobbler::Artist)
125
+ first.artist.name.should ==('Vampire Weekend')
126
+ first.artist.mbid.should ==('af37c51c-0790-4a29-b995-456f98a6b8c9')
127
+ first.artist.url.should ==('http://www.last.fm/music/Vampire+Weekend')
128
+ first.image(:small).should ==('http://userserve-ak.last.fm/serve/34s/10258165.jpg')
129
+ first.image(:medium).should ==('http://userserve-ak.last.fm/serve/64s/10258165.jpg')
130
+ first.image(:large).should ==('http://userserve-ak.last.fm/serve/126/10258165.jpg')
131
131
  end
132
132
 
133
133
  end
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../spec_helper.rb'
3
3
  describe Scrobbler::Playlist do
4
4
 
5
5
  before(:all) do
6
- @playlist = Scrobbler::Playlist.new('lastfm://playlist/album/2026126')
6
+ @playlist = Scrobbler::Playlist.new(:url => 'lastfm://playlist/album/2026126')
7
7
  end
8
8
 
9
9
  it 'should know its url' do
@@ -1,7 +1,7 @@
1
1
  describe Scrobbler::Scrobble do
2
2
  before do
3
3
  Scrobbler::Scrobble.client_id = 'spec'
4
- @user = Scrobbler::User.new('TestUser')
4
+ @user = Scrobbler::User.new(:name => 'TestUser')
5
5
  @session = Scrobbler::Session.new(:key => 'testKey', :name => 'testName', :subscriber => true)
6
6
  @scrobble = Scrobbler::Scrobble.new(:handshake_on_init => false, :user => @user, :session => @session)
7
7
  end