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/.gitignore +3 -0
- data/VERSION.yml +2 -1
- data/lib/scrobbler/album.rb +91 -113
- data/lib/scrobbler/artist.rb +174 -134
- data/lib/scrobbler/auth.rb +12 -0
- data/lib/scrobbler/base.rb +114 -64
- data/lib/scrobbler/basexml.rb +17 -0
- data/lib/scrobbler/event.rb +109 -74
- data/lib/scrobbler/geo.rb +3 -11
- data/lib/scrobbler/helper/image.rb +37 -12
- data/lib/scrobbler/helper/streamable.rb +11 -3
- data/lib/scrobbler/library.rb +49 -75
- data/lib/scrobbler/playlist.rb +74 -32
- data/lib/scrobbler/radio.rb +11 -0
- data/lib/scrobbler/shout.rb +40 -14
- data/lib/scrobbler/tag.rb +19 -2
- data/lib/scrobbler/track.rb +62 -67
- data/lib/scrobbler/user.rb +93 -111
- data/lib/scrobbler.rb +1 -2
- data/tasks/jeweler.rake +10 -6
- data/tasks/metric_fu.rake +27 -0
- data/tasks/reek.rake +13 -0
- data/tasks/roodi.rake +13 -0
- data/tasks/tests.rake +8 -0
- data/test/mocks/library.rb +35 -0
- data/test/mocks/rest.rb +91 -189
- data/test/test_helper.rb +2 -16
- data/test/unit/album_spec.rb +1 -1
- data/test/unit/artist_spec.rb +4 -2
- data/test/unit/event_spec.rb +2 -2
- data/test/unit/library_spec.rb +70 -70
- data/test/unit/playlist_spec.rb +1 -1
- data/test/unit/scrobble_spec.rb +1 -1
- data/test/unit/tag_spec.rb +3 -1
- data/test/unit/track_spec.rb +1 -1
- data/test/unit/user_spec.rb +1 -1
- metadata +38 -6
data/test/mocks/rest.rb
CHANGED
@@ -1,212 +1,114 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
2
3
|
require 'rubygems'
|
3
4
|
require 'fakeweb'
|
4
|
-
require '
|
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
|
-
|
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
|
-
|
65
|
-
|
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
|
-
|
70
|
-
|
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
|
-
|
74
|
-
|
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
|
-
|
78
|
-
|
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
|
-
|
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
|
-
|
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, '
|
89
|
-
FakeWeb.register_uri(:get, '
|
90
|
-
FakeWeb.register_uri(:get, '
|
91
|
-
FakeWeb.register_uri(:get, '
|
92
|
-
FakeWeb.register_uri(:get, '
|
93
|
-
FakeWeb.register_uri(:get, '
|
94
|
-
FakeWeb.register_uri(:get, '
|
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
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
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.
|
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'
|
data/test/unit/album_spec.rb
CHANGED
@@ -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
|
data/test/unit/artist_spec.rb
CHANGED
@@ -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.
|
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')
|
data/test/unit/event_spec.rb
CHANGED
@@ -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.
|
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
|
|
data/test/unit/library_spec.rb
CHANGED
@@ -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
|
33
|
-
first.name.should
|
34
|
-
first.playcount.should
|
35
|
-
first.tagcount.should
|
36
|
-
first.mbid.should
|
37
|
-
first.url.should
|
38
|
-
first.artist.should be_kind_of
|
39
|
-
first.artist.name.should
|
40
|
-
first.artist.mbid.should
|
41
|
-
first.artist.url.should
|
42
|
-
first.image(:small).should
|
43
|
-
first.image(:medium).should
|
44
|
-
first.image(:large).should
|
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
|
51
|
-
first.name.should
|
52
|
-
first.playcount.should
|
53
|
-
first.tagcount.should
|
54
|
-
first.mbid.should
|
55
|
-
first.url.should
|
56
|
-
first.artist.should be_kind_of
|
57
|
-
first.artist.name.should
|
58
|
-
first.artist.mbid.should
|
59
|
-
first.artist.url.should
|
60
|
-
first.image(:small).should
|
61
|
-
first.image(:medium).should
|
62
|
-
first.image(:large).should
|
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
|
69
|
-
first.name.should
|
70
|
-
first.playcount.should
|
71
|
-
first.tagcount.should
|
72
|
-
first.mbid.should
|
73
|
-
first.url.should
|
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
|
76
|
-
first.image(:medium).should
|
77
|
-
first.image(:large).should
|
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
|
84
|
-
first.name.should
|
85
|
-
first.playcount.should
|
86
|
-
first.tagcount.should
|
87
|
-
first.mbid.should
|
88
|
-
first.url.should
|
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
|
91
|
-
first.image(:medium).should
|
92
|
-
first.image(:large).should
|
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
|
99
|
-
first.name.should
|
100
|
-
first.playcount.should
|
101
|
-
first.tagcount.should
|
102
|
-
first.mbid.should
|
103
|
-
first.url.should
|
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
|
106
|
-
first.artist.name.should
|
107
|
-
first.artist.mbid.should
|
108
|
-
first.artist.url.should
|
109
|
-
first.image(:small).should
|
110
|
-
first.image(:medium).should
|
111
|
-
first.image(:large).should
|
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
|
118
|
-
first.name.should
|
119
|
-
first.playcount.should
|
120
|
-
first.tagcount.should
|
121
|
-
first.mbid.should
|
122
|
-
first.url.should
|
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
|
125
|
-
first.artist.name.should
|
126
|
-
first.artist.mbid.should
|
127
|
-
first.artist.url.should
|
128
|
-
first.image(:small).should
|
129
|
-
first.image(:medium).should
|
130
|
-
first.image(:large).should
|
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
|
data/test/unit/playlist_spec.rb
CHANGED
@@ -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
|
data/test/unit/scrobble_spec.rb
CHANGED
@@ -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
|