lastfm 1.27.3 → 1.27.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 147a742ed4bc98a34afd011ec2a27d9dc927a905
4
- data.tar.gz: 9453ede5c8f07680fd82b780b95e37e74d596079
3
+ metadata.gz: 97fb464cf27713555c45f696a2c7489906c6d8dc
4
+ data.tar.gz: 93856d36bde02f40e1b9180f151e29363fc51ef8
5
5
  SHA512:
6
- metadata.gz: 54946841482df488dd3ebbb639863362aa1c37b9f44e4739322babc2c955ff25b9eb91f1f8b6e2d5c8580c0dbfdc6846491061aa729e67f80099fd3cc1956859
7
- data.tar.gz: e03e1f766ce0b57cc0ae55af7558d153329c382be08c17074f9ea04d4b13ecd1c44fd60a2bace4fc5f50149c6d615723da4239b348df0b0447f6b59312cade20
6
+ metadata.gz: 0f0c940d644e5fd4f4c55d0c77ef4e1fa8be5e5252e9e00a2552296745ab4f892478da72d09021b752a7770035c76e065cd8941d900b3d16c2bf6afaa04e3259
7
+ data.tar.gz: 874c706e479275dbff678f62bee3dd87767e8c074722dd4bc08161a1981becbb80608a118f35abdd536353781cbed9c654be7de32a98cb06786289ad29db9d8e
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
- -c
2
- -fs
1
+ --color
2
+ --format documentation
@@ -12,12 +12,12 @@ Gem::Specification.new do |gem|
12
12
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
13
13
  gem.name = %q{lastfm}
14
14
  gem.require_paths = ["lib"]
15
- gem.version = "1.27.3"
15
+ gem.version = "1.27.4"
16
16
  gem.license = 'MIT'
17
17
 
18
18
  gem.add_dependency "xml-simple"
19
19
  gem.add_dependency "httparty"
20
20
 
21
- gem.add_development_dependency('rspec', ['~> 2.8.0'])
22
- gem.add_development_dependency('rake', '< 11.0')
21
+ gem.add_development_dependency('rspec', ['~> 3.4.0'])
22
+ gem.add_development_dependency('rake', '< 12.3.3')
23
23
  end
@@ -5,105 +5,105 @@ describe "Lastfm" do
5
5
 
6
6
  describe '.new' do
7
7
  it 'should instantiate' do
8
- @lastfm.should be_an_instance_of(Lastfm)
8
+ expect(@lastfm).to be_an_instance_of(Lastfm)
9
9
  end
10
10
  end
11
11
 
12
12
  describe '#request' do
13
13
  it 'should post' do
14
- mock_response = mock(HTTParty::Response)
15
- HTTPRequest.should_receive(:post).with('/', :body => {
14
+ mock_response = double(HTTParty::Response)
15
+ expect(HTTPRequest).to receive(:post).with('/', :body => {
16
16
  :foo => 'bar',
17
17
  :method => 'xxx.yyy',
18
18
  :api_key => 'xxx',
19
19
  }).and_return(mock_response)
20
- mock_response.should_receive(:body).and_return(@response_xml)
20
+ expect(mock_response).to receive(:body).and_return(@response_xml)
21
21
  @lastfm.request('xxx.yyy', { :foo => 'bar' }, :post, false, false)
22
22
  end
23
23
 
24
24
  it 'should post with signature' do
25
- mock_response = mock(HTTParty::Response)
26
- HTTPRequest.should_receive(:post).with('/', :body => {
25
+ mock_response = double(HTTParty::Response)
26
+ expect(HTTPRequest).to receive(:post).with('/', :body => {
27
27
  :foo => 'bar',
28
28
  :method => 'xxx.yyy',
29
29
  :api_key => 'xxx',
30
30
  :api_sig => Digest::MD5.hexdigest('api_keyxxxfoobarmethodxxx.yyyyyy'),
31
31
  }).and_return(mock_response)
32
- mock_response.should_receive(:body).and_return(@response_xml)
32
+ expect(mock_response).to receive(:body).and_return(@response_xml)
33
33
  @lastfm.request('xxx.yyy', { :foo => 'bar' }, :post, true, false)
34
34
  end
35
35
 
36
36
  it 'should post with signature and session (request with authentication)' do
37
- mock_response = mock(HTTParty::Response)
37
+ mock_response = double(HTTParty::Response)
38
38
  @lastfm.session = 'abcdef'
39
- HTTPRequest.should_receive(:post).with('/', :body => {
39
+ expect(HTTPRequest).to receive(:post).with('/', :body => {
40
40
  :foo => 'bar',
41
41
  :method => 'xxx.yyy',
42
42
  :api_key => 'xxx',
43
43
  :api_sig => Digest::MD5.hexdigest('api_keyxxxfoobarmethodxxx.yyyskabcdefyyy'),
44
44
  :sk => 'abcdef',
45
45
  }).and_return(mock_response)
46
- mock_response.should_receive(:body).and_return(@response_xml)
46
+ expect(mock_response).to receive(:body).and_return(@response_xml)
47
47
  @lastfm.request('xxx.yyy', { :foo => 'bar' }, :post, true, true)
48
48
  end
49
49
 
50
50
  it 'should get' do
51
- mock_response = mock(HTTParty::Response)
52
- HTTPRequest.should_receive(:get).with('/', :query => {
51
+ mock_response = double(HTTParty::Response)
52
+ expect(HTTPRequest).to receive(:get).with('/', :query => {
53
53
  :foo => 'bar',
54
54
  :method => 'xxx.yyy',
55
55
  :api_key => 'xxx',
56
56
  }).and_return(mock_response)
57
- mock_response.should_receive(:body).and_return(@response_xml)
57
+ expect(mock_response).to receive(:body).and_return(@response_xml)
58
58
  @lastfm.request('xxx.yyy', { :foo => 'bar' }, :get, false, false)
59
59
  end
60
60
 
61
61
  it 'should get with signature (request for authentication)' do
62
- mock_response = mock(HTTParty::Response)
63
- HTTPRequest.should_receive(:get).with('/', :query => {
62
+ mock_response = double(HTTParty::Response)
63
+ expect(HTTPRequest).to receive(:get).with('/', :query => {
64
64
  :foo => 'bar',
65
65
  :method => 'xxx.yyy',
66
66
  :api_key => 'xxx',
67
67
  :api_sig => Digest::MD5.hexdigest('api_keyxxxfoobarmethodxxx.yyyyyy'),
68
68
  }).and_return(mock_response)
69
- mock_response.should_receive(:body).and_return(@response_xml)
69
+ expect(mock_response).to receive(:body).and_return(@response_xml)
70
70
  @lastfm.request('xxx.yyy', { :foo => 'bar' }, :get, true, false)
71
71
  end
72
72
 
73
73
  it 'should get with signature and session' do
74
- mock_response = mock(HTTParty::Response)
74
+ mock_response = double(HTTParty::Response)
75
75
  @lastfm.session = 'abcdef'
76
- HTTPRequest.should_receive(:get).with('/', :query => {
76
+ expect(HTTPRequest).to receive(:get).with('/', :query => {
77
77
  :foo => 'bar',
78
78
  :method => 'xxx.yyy',
79
79
  :api_key => 'xxx',
80
80
  :api_sig => Digest::MD5.hexdigest('api_keyxxxfoobarmethodxxx.yyyskabcdefyyy'),
81
81
  :sk => 'abcdef',
82
82
  }).and_return(mock_response)
83
- mock_response.should_receive(:body).and_return(@response_xml)
83
+ expect(mock_response).to receive(:body).and_return(@response_xml)
84
84
  @lastfm.request('xxx.yyy', { :foo => 'bar' }, :get, true, true)
85
85
  end
86
86
 
87
87
  it 'should raise an error if an api error is ocuured' do
88
- mock_response = mock(HTTParty::Response)
89
- mock_response.should_receive(:body).and_return(open(fixture('ng.xml')).read)
90
- HTTPRequest.should_receive(:post).and_return(mock_response)
88
+ mock_response = double(HTTParty::Response)
89
+ expect(mock_response).to receive(:body).and_return(open(fixture('ng.xml')).read)
90
+ expect(HTTPRequest).to receive(:post).and_return(mock_response)
91
91
 
92
- lambda {
92
+ expect {
93
93
  @lastfm.request('xxx.yyy', { :foo => 'bar' }, :post)
94
- }.should raise_error(Lastfm::ApiError, 'Invalid API key - You must be granted a valid key by last.fm') {|error|
95
- error.code.should == 10
94
+ }.to raise_error(Lastfm::ApiError, 'Invalid API key - You must be granted a valid key by last.fm') {|error|
95
+ expect(error.code).to eq(10)
96
96
  }
97
97
  end
98
98
  end
99
99
 
100
100
  describe '#auth' do
101
101
  it 'should return an instance of Lastfm::Auth' do
102
- @lastfm.auth.should be_an_instance_of(Lastfm::MethodCategory::Auth)
102
+ expect(@lastfm.auth).to be_an_instance_of(Lastfm::MethodCategory::Auth)
103
103
  end
104
104
 
105
105
  it 'should get token' do
106
- @lastfm.should_receive(:request).
106
+ expect(@lastfm).to receive(:request).
107
107
  with('auth.getToken', {}, :get, true).
108
108
  and_return(make_response(<<XML))
109
109
  <?xml version="1.0" encoding="utf-8"?>
@@ -111,11 +111,11 @@ describe "Lastfm" do
111
111
  <token>xxxyyyzzz</token></lfm>
112
112
  XML
113
113
 
114
- @lastfm.auth.get_token.should == 'xxxyyyzzz'
114
+ expect(@lastfm.auth.get_token).to eq('xxxyyyzzz')
115
115
  end
116
116
 
117
117
  it 'should get session' do
118
- @lastfm.should_receive(:request).
118
+ expect(@lastfm).to receive(:request).
119
119
  with('auth.getSession', { :token => 'xxxyyyzzz' }, :get, true).
120
120
  and_return(make_response(<<XML))
121
121
  <?xml version="1.0" encoding="utf-8"?>
@@ -128,12 +128,12 @@ XML
128
128
  </lfm>
129
129
  XML
130
130
  session = @lastfm.auth.get_session('xxxyyyzzz')
131
- session['name'].should == 'MyLastFMUsername'
132
- session['key'].should == 'zzzyyyxxx'
131
+ expect(session['name']).to eq('MyLastFMUsername')
132
+ expect(session['key']).to eq('zzzyyyxxx')
133
133
  end
134
134
 
135
135
  it 'should get mobile session' do
136
- @lastfm.should_receive(:request).
136
+ expect(@lastfm).to receive(:request).
137
137
  with('auth.getMobileSession', { :username => 'xxxyyyzzz', :password => 'sekretz' }, :post, true, false, true).
138
138
  and_return(make_response(<<XML))
139
139
  <?xml version="1.0" encoding="utf-8"?>
@@ -146,8 +146,8 @@ XML
146
146
  </lfm>
147
147
  XML
148
148
  session = @lastfm.auth.get_mobile_session('xxxyyyzzz', 'sekretz')
149
- session['name'].should == 'MyLastFMUsername'
150
- session['key'].should == 'zzzyyyxxx'
149
+ expect(session['name']).to eq('MyLastFMUsername')
150
+ expect(session['key']).to eq('zzzyyyxxx')
151
151
  end
152
152
  end
153
153
  end
@@ -6,6 +6,6 @@ describe 'Lastfm::MethodCategory' do
6
6
  end
7
7
 
8
8
  it 'should have instance of Lastfm' do
9
- Lastfm::MethodCategory::Base.new(@lastfm).instance_eval { @lastfm }.should equal(@lastfm)
9
+ expect(Lastfm::MethodCategory::Base.new(@lastfm).instance_eval { @lastfm }).to equal(@lastfm)
10
10
  end
11
11
  end
@@ -5,28 +5,28 @@ describe '#album' do
5
5
  before { init_lastfm }
6
6
 
7
7
  it 'should return an instance of Lastfm::Album' do
8
- @lastfm.album.should be_an_instance_of(Lastfm::MethodCategory::Album)
8
+ expect(@lastfm.album).to be_an_instance_of(Lastfm::MethodCategory::Album)
9
9
  end
10
10
 
11
11
  describe '#add_tags' do
12
12
  it 'should add tags' do
13
- @lastfm.should_receive(:request).with('album.addTags', {
13
+ expect(@lastfm).to receive(:request).with('album.addTags', {
14
14
  :artist => 'foo artist',
15
15
  :album => 'foo track',
16
16
  :tags => 'aaa,bbb,ccc'
17
17
  }, :post, true, true).and_return(@ok_response)
18
18
 
19
- @lastfm.album.add_tags(
19
+ expect(@lastfm.album.add_tags(
20
20
  :artist => 'foo artist',
21
21
  :album => 'foo track',
22
22
  :tags => 'aaa,bbb,ccc'
23
- ).should be_true
23
+ )).to be_truthy
24
24
  end
25
25
  end
26
26
 
27
27
  describe '#get_buylinks' do
28
28
  it 'should get buylinks' do
29
- @lastfm.should_receive(:request).with('album.getBuylinks', {
29
+ expect(@lastfm).to receive(:request).with('album.getBuylinks', {
30
30
  :artist => 'radiohead',
31
31
  :album => 'in rainbows',
32
32
  :country => 'united kingdom',
@@ -39,23 +39,23 @@ describe '#album' do
39
39
  :country => 'united kingdom'
40
40
  )
41
41
 
42
- buylinks['physicals'].size.should == 1
43
- buylinks['physicals']['affiliation']['supplierName'].should == 'Amazon'
44
- buylinks['physicals']['affiliation']['price']['currency'].should == 'GBP'
45
- buylinks['physicals']['affiliation']['price']['amount'].should == '6.34'
46
- buylinks['physicals']['affiliation']['price']['formatted'].should == '£6.34'
47
- buylinks['physicals']['affiliation']['buyLink'].should == 'http://www.last.fm/affiliate/byid/8/3418994/1/ws.album.buylinks.f4e2585261d8d10d3297e181d68940fc'
48
-
49
- buylinks['downloads'].size.should == 1
50
- buylinks['downloads']['affiliation']['supplierName'].should == 'Amazon MP3'
51
- buylinks['downloads']['affiliation']['price']['currency'].should == 'GBP'
52
- buylinks['downloads']['affiliation']['price']['amount'].should == '7.99'
53
- buylinks['downloads']['affiliation']['price']['formatted'].should == '£7.99'
54
- buylinks['downloads']['affiliation']['buyLink'].should == 'http://www.last.fm/affiliate/byid/8/3418994/44/ws.album.buylinks.f4e2585261d8d10d3297e181d68940fc'
42
+ expect(buylinks['physicals'].size).to eq(1)
43
+ expect(buylinks['physicals']['affiliation']['supplierName']).to eq('Amazon')
44
+ expect(buylinks['physicals']['affiliation']['price']['currency']).to eq('GBP')
45
+ expect(buylinks['physicals']['affiliation']['price']['amount']).to eq('6.34')
46
+ expect(buylinks['physicals']['affiliation']['price']['formatted']).to eq('£6.34')
47
+ expect(buylinks['physicals']['affiliation']['buyLink']).to eq('http://www.last.fm/affiliate/byid/8/3418994/1/ws.album.buylinks.f4e2585261d8d10d3297e181d68940fc')
48
+
49
+ expect(buylinks['downloads'].size).to eq(1)
50
+ expect(buylinks['downloads']['affiliation']['supplierName']).to eq('Amazon MP3')
51
+ expect(buylinks['downloads']['affiliation']['price']['currency']).to eq('GBP')
52
+ expect(buylinks['downloads']['affiliation']['price']['amount']).to eq('7.99')
53
+ expect(buylinks['downloads']['affiliation']['price']['formatted']).to eq('£7.99')
54
+ expect(buylinks['downloads']['affiliation']['buyLink']).to eq('http://www.last.fm/affiliate/byid/8/3418994/44/ws.album.buylinks.f4e2585261d8d10d3297e181d68940fc')
55
55
  end
56
56
 
57
57
  it 'should get buylinks by mbid' do
58
- @lastfm.should_receive(:request).with('album.getBuylinks', {
58
+ expect(@lastfm).to receive(:request).with('album.getBuylinks', {
59
59
  :mbid => 'radiohead',
60
60
  :country => 'united kingdom',
61
61
  :autocorrect => nil
@@ -66,19 +66,19 @@ describe '#album' do
66
66
  :country => 'united kingdom'
67
67
  )
68
68
 
69
- buylinks['physicals'].size.should == 1
70
- buylinks['physicals']['affiliation']['supplierName'].should == 'Amazon'
71
- buylinks['physicals']['affiliation']['price']['currency'].should == 'GBP'
72
- buylinks['physicals']['affiliation']['price']['amount'].should == '6.34'
73
- buylinks['physicals']['affiliation']['price']['formatted'].should == '£6.34'
74
- buylinks['physicals']['affiliation']['buyLink'].should == 'http://www.last.fm/affiliate/byid/8/3418994/1/ws.album.buylinks.f4e2585261d8d10d3297e181d68940fc'
75
-
76
- buylinks['downloads'].size.should == 1
77
- buylinks['downloads']['affiliation']['supplierName'].should == 'Amazon MP3'
78
- buylinks['downloads']['affiliation']['price']['currency'].should == 'GBP'
79
- buylinks['downloads']['affiliation']['price']['amount'].should == '7.99'
80
- buylinks['downloads']['affiliation']['price']['formatted'].should == '£7.99'
81
- buylinks['downloads']['affiliation']['buyLink'].should == 'http://www.last.fm/affiliate/byid/8/3418994/44/ws.album.buylinks.f4e2585261d8d10d3297e181d68940fc'
69
+ expect(buylinks['physicals'].size).to eq(1)
70
+ expect(buylinks['physicals']['affiliation']['supplierName']).to eq('Amazon')
71
+ expect(buylinks['physicals']['affiliation']['price']['currency']).to eq('GBP')
72
+ expect(buylinks['physicals']['affiliation']['price']['amount']).to eq('6.34')
73
+ expect(buylinks['physicals']['affiliation']['price']['formatted']).to eq('£6.34')
74
+ expect(buylinks['physicals']['affiliation']['buyLink']).to eq('http://www.last.fm/affiliate/byid/8/3418994/1/ws.album.buylinks.f4e2585261d8d10d3297e181d68940fc')
75
+
76
+ expect(buylinks['downloads'].size).to eq(1)
77
+ expect(buylinks['downloads']['affiliation']['supplierName']).to eq('Amazon MP3')
78
+ expect(buylinks['downloads']['affiliation']['price']['currency']).to eq('GBP')
79
+ expect(buylinks['downloads']['affiliation']['price']['amount']).to eq('7.99')
80
+ expect(buylinks['downloads']['affiliation']['price']['formatted']).to eq('£7.99')
81
+ expect(buylinks['downloads']['affiliation']['buyLink']).to eq('http://www.last.fm/affiliate/byid/8/3418994/44/ws.album.buylinks.f4e2585261d8d10d3297e181d68940fc')
82
82
  end
83
83
 
84
84
  it 'should raise ArgumentError without country' do
@@ -95,56 +95,56 @@ describe '#album' do
95
95
 
96
96
  describe '#get_info' do
97
97
  it 'should get info by artist and album' do
98
- @lastfm.should_receive(:request).with('album.getInfo', {
98
+ expect(@lastfm).to receive(:request).with('album.getInfo', {
99
99
  :artist => 'Cher', :album => 'Believe'
100
100
  }).and_return(make_response('album_get_info'))
101
101
 
102
102
  album = @lastfm.album.get_info(:artist => 'Cher', :album => 'Believe')
103
- album['name'].should == 'Believe'
104
- album['artist'].should == 'Cher'
105
- album['id'].should == '2026126'
106
- album['mbid'].should == '61bf0388-b8a9-48f4-81d1-7eb02706dfb0'
107
- album['url'].should == 'http://www.last.fm/music/Cher/Believe'
108
- album['image'].size.should == 5
109
- album['releasedate'].should == '6 Apr 1999, 00:00'
110
- album['tracks']['track'].size.should == 10
111
- album['tracks']['track'][0]['name'].should == 'Believe'
112
- album['tracks']['track'][0]['duration'].should == '239'
113
- album['tracks']['track'][0]['url'].should == 'http://www.last.fm/music/Cher/_/Believe'
103
+ expect(album['name']).to eq('Believe')
104
+ expect(album['artist']).to eq('Cher')
105
+ expect(album['id']).to eq('2026126')
106
+ expect(album['mbid']).to eq('61bf0388-b8a9-48f4-81d1-7eb02706dfb0')
107
+ expect(album['url']).to eq('http://www.last.fm/music/Cher/Believe')
108
+ expect(album['image'].size).to eq(5)
109
+ expect(album['releasedate']).to eq('6 Apr 1999, 00:00')
110
+ expect(album['tracks']['track'].size).to eq(10)
111
+ expect(album['tracks']['track'][0]['name']).to eq('Believe')
112
+ expect(album['tracks']['track'][0]['duration']).to eq('239')
113
+ expect(album['tracks']['track'][0]['url']).to eq('http://www.last.fm/music/Cher/_/Believe')
114
114
  end
115
115
 
116
116
  it 'should get info by mbid' do
117
- @lastfm.should_receive(:request).with('album.getInfo', {
117
+ expect(@lastfm).to receive(:request).with('album.getInfo', {
118
118
  :mbid => 'xxxxx'
119
119
  }).and_return(make_response('album_get_info'))
120
120
 
121
121
  album = @lastfm.album.get_info(:mbid => 'xxxxx')
122
- album['name'].should == 'Believe'
123
- album['artist'].should == 'Cher'
124
- album['id'].should == '2026126'
125
- album['mbid'].should == '61bf0388-b8a9-48f4-81d1-7eb02706dfb0'
126
- album['url'].should == 'http://www.last.fm/music/Cher/Believe'
127
- album['image'].size.should == 5
128
- album['releasedate'].should == '6 Apr 1999, 00:00'
129
- album['tracks']['track'].size.should == 10
130
- album['tracks']['track'][0]['name'].should == 'Believe'
131
- album['tracks']['track'][0]['duration'].should == '239'
132
- album['tracks']['track'][0]['url'].should == 'http://www.last.fm/music/Cher/_/Believe'
122
+ expect(album['name']).to eq('Believe')
123
+ expect(album['artist']).to eq('Cher')
124
+ expect(album['id']).to eq('2026126')
125
+ expect(album['mbid']).to eq('61bf0388-b8a9-48f4-81d1-7eb02706dfb0')
126
+ expect(album['url']).to eq('http://www.last.fm/music/Cher/Believe')
127
+ expect(album['image'].size).to eq(5)
128
+ expect(album['releasedate']).to eq('6 Apr 1999, 00:00')
129
+ expect(album['tracks']['track'].size).to eq(10)
130
+ expect(album['tracks']['track'][0]['name']).to eq('Believe')
131
+ expect(album['tracks']['track'][0]['duration']).to eq('239')
132
+ expect(album['tracks']['track'][0]['url']).to eq('http://www.last.fm/music/Cher/_/Believe')
133
133
  end
134
134
 
135
135
  it 'works without release date' do
136
- @lastfm.should_receive(:request).with('album.getInfo', {
136
+ expect(@lastfm).to receive(:request).with('album.getInfo', {
137
137
  :mbid => 'xxxxx'
138
138
  }).and_return(make_response('album_get_info_without_release_date'))
139
139
 
140
140
  album = @lastfm.album.get_info(:mbid => 'xxxxx')
141
- album['name'].should == 'Believe'
141
+ expect(album['name']).to eq('Believe')
142
142
  end
143
143
  end
144
144
 
145
145
  describe '#get_shouts' do
146
146
  it 'should get shouts' do
147
- @lastfm.should_receive(:request).with('album.getShouts', {
147
+ expect(@lastfm).to receive(:request).with('album.getShouts', {
148
148
  :artist => 'Cher',
149
149
  :album => 'Believe',
150
150
  :autocorrect => nil,
@@ -155,16 +155,16 @@ describe '#album' do
155
155
  shouts = @lastfm.album.get_shouts(
156
156
  :artist => 'Cher',
157
157
  :album => 'Believe')
158
- shouts.size.should == 2
159
- shouts[0]['body'].should == 'A perfect Pop/Dance Masterpiece'
160
- shouts[0]['author'].should == 'top20fanatico'
161
- shouts[0]['date'].should == 'Wed, 7 Jan 2015 12:45:35'
158
+ expect(shouts.size).to eq(2)
159
+ expect(shouts[0]['body']).to eq('A perfect Pop/Dance Masterpiece')
160
+ expect(shouts[0]['author']).to eq('top20fanatico')
161
+ expect(shouts[0]['date']).to eq('Wed, 7 Jan 2015 12:45:35')
162
162
  end
163
163
  end
164
164
 
165
165
  describe '#get_tags' do
166
166
  it 'should get tags' do
167
- @lastfm.should_receive(:request).with('album.getTags', {
167
+ expect(@lastfm).to receive(:request).with('album.getTags', {
168
168
  :artist => 'Cher',
169
169
  :album => 'Believe',
170
170
  :autocorrect => nil
@@ -173,15 +173,15 @@ describe '#album' do
173
173
  tags = @lastfm.album.get_tags(
174
174
  :artist => 'Cher',
175
175
  :album => 'Believe')
176
- tags.size.should == 2
177
- tags[0]['name'].should == 'sourabh'
178
- tags[0]['url'].should == 'http://www.last.fm/tag/sourabh'
176
+ expect(tags.size).to eq(2)
177
+ expect(tags[0]['name']).to eq('sourabh')
178
+ expect(tags[0]['url']).to eq('http://www.last.fm/tag/sourabh')
179
179
  end
180
180
  end
181
181
 
182
182
  describe '#get_top_tags' do
183
183
  it 'should get top tags' do
184
- @lastfm.should_receive(:request).with('album.getTopTags', {
184
+ expect(@lastfm).to receive(:request).with('album.getTopTags', {
185
185
  :artist => 'Radiohead',
186
186
  :album => 'The Bends',
187
187
  :autocorrect => nil
@@ -190,31 +190,31 @@ describe '#album' do
190
190
  tags = @lastfm.album.get_top_tags(
191
191
  :artist => 'Radiohead',
192
192
  :album => 'The Bends')
193
- tags.size.should == 2
194
- tags[0]['name'].should == 'albums I own'
195
- tags[0]['count'].should == '100'
196
- tags[0]['url'].should == 'http://www.last.fm/tag/albums%20i%20own'
193
+ expect(tags.size).to eq(2)
194
+ expect(tags[0]['name']).to eq('albums I own')
195
+ expect(tags[0]['count']).to eq('100')
196
+ expect(tags[0]['url']).to eq('http://www.last.fm/tag/albums%20i%20own')
197
197
  end
198
198
  end
199
199
 
200
200
  describe '#remove_tag' do
201
201
  it 'should remove tag' do
202
- @lastfm.should_receive(:request).with('album.removeTag', {
202
+ expect(@lastfm).to receive(:request).with('album.removeTag', {
203
203
  :artist => 'foo artist',
204
204
  :album => 'foo track',
205
205
  :tag => 'aaa'
206
206
  }, :post, true, true).and_return(@ok_response)
207
207
 
208
- @lastfm.album.remove_tag(
208
+ expect(@lastfm.album.remove_tag(
209
209
  :artist => 'foo artist',
210
210
  :album => 'foo track',
211
- :tag => 'aaa').should be_true
211
+ :tag => 'aaa')).to be_truthy
212
212
  end
213
213
  end
214
214
 
215
215
  describe '#search' do
216
216
  it 'should search' do
217
- @lastfm.should_receive(:request).with('album.search', {
217
+ expect(@lastfm).to receive(:request).with('album.search', {
218
218
  :album => 'Believe',
219
219
  :limit => nil,
220
220
  :page => nil,
@@ -222,14 +222,14 @@ describe '#album' do
222
222
 
223
223
  albums = @lastfm.album.search(:album => 'Believe')
224
224
 
225
- albums['results']['for'].should == 'Believe'
226
- albums['results']['totalResults'].should == '3926'
227
- albums['results']['albummatches']['album'].size.should == 2
228
- albums['results']['albummatches']['album'][0]['name'].should == 'Believe'
225
+ expect(albums['results']['for']).to eq('Believe')
226
+ expect(albums['results']['totalResults']).to eq('3926')
227
+ expect(albums['results']['albummatches']['album'].size).to eq(2)
228
+ expect(albums['results']['albummatches']['album'][0]['name']).to eq('Believe')
229
229
  end
230
230
 
231
231
  it 'should always return an array of albums' do
232
- @lastfm.should_receive(:request).with('album.search', {
232
+ expect(@lastfm).to receive(:request).with('album.search', {
233
233
  :album => 'Believe',
234
234
  :limit => nil,
235
235
  :page => nil,
@@ -237,14 +237,14 @@ describe '#album' do
237
237
 
238
238
  albums = @lastfm.album.search(:album => 'Believe')
239
239
 
240
- albums['results']['for'].should == 'Believe'
241
- albums['results']['totalResults'].should == '3926'
242
- albums['results']['albummatches']['album'].size.should == 1
243
- albums['results']['albummatches']['album'][0]['name'].should == 'Believe'
240
+ expect(albums['results']['for']).to eq('Believe')
241
+ expect(albums['results']['totalResults']).to eq('3926')
242
+ expect(albums['results']['albummatches']['album'].size).to eq(1)
243
+ expect(albums['results']['albummatches']['album'][0]['name']).to eq('Believe')
244
244
  end
245
245
 
246
246
  it 'should return an empty array if no match found' do
247
- @lastfm.should_receive(:request).with('album.search', {
247
+ expect(@lastfm).to receive(:request).with('album.search', {
248
248
  :album => 'Believe',
249
249
  :limit => nil,
250
250
  :page => nil,
@@ -252,15 +252,15 @@ describe '#album' do
252
252
 
253
253
  albums = @lastfm.album.search(:album => 'Believe')
254
254
 
255
- albums['results']['for'].should == 'Believe'
256
- albums['results']['totalResults'].should == '0'
257
- albums['results']['albummatches']['album'].size.should == 0
255
+ expect(albums['results']['for']).to eq('Believe')
256
+ expect(albums['results']['totalResults']).to eq('0')
257
+ expect(albums['results']['albummatches']['album'].size).to eq(0)
258
258
  end
259
259
  end
260
260
 
261
261
  describe '#share' do
262
262
  it 'should share' do
263
- @lastfm.should_receive(:request).with('album.share', {
263
+ expect(@lastfm).to receive(:request).with('album.share', {
264
264
  :artist => 'bar artist',
265
265
  :album => 'bar album',
266
266
  :recipient => 'bar@example.com',
@@ -268,12 +268,12 @@ describe '#album' do
268
268
  :public => nil,
269
269
  }, :post, true, true).and_return(@ok_response)
270
270
 
271
- @lastfm.album.share(
271
+ expect(@lastfm.album.share(
272
272
  :artist => 'bar artist',
273
273
  :album => 'bar album',
274
274
  :recipient => 'bar@example.com',
275
275
  :message => 'this is a message',
276
- ).should be_true
276
+ )).to be_truthy
277
277
  end
278
278
  end
279
279
  end