discogs-wrapper 2.1.4 → 2.2.0
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.
- checksums.yaml +4 -4
- data/lib/discogs.rb +1 -2
- data/lib/wrapper/wrapper.rb +25 -20
- data/spec/spec_helper.rb +9 -0
- data/spec/wrapper_methods/add_release_to_user_wantlist_spec.rb +15 -9
- data/spec/wrapper_methods/edit_release_in_user_wantlist_spec.rb +14 -8
- data/spec/wrapper_methods/edit_user_spec.rb +15 -8
- data/spec/wrapper_methods/get_artist_releases_spec.rb +6 -11
- data/spec/wrapper_methods/get_artist_spec.rb +4 -9
- data/spec/wrapper_methods/get_identity_spec.rb +14 -8
- data/spec/wrapper_methods/get_label_releases_spec.rb +6 -11
- data/spec/wrapper_methods/get_label_spec.rb +14 -19
- data/spec/wrapper_methods/get_listing_spec.rb +16 -9
- data/spec/wrapper_methods/get_master_release_spec.rb +16 -21
- data/spec/wrapper_methods/get_master_release_versions_spec.rb +6 -11
- data/spec/wrapper_methods/get_order_messages_spec.rb +15 -8
- data/spec/wrapper_methods/get_order_spec.rb +15 -8
- data/spec/wrapper_methods/get_price_suggestions_spec.rb +15 -8
- data/spec/wrapper_methods/get_release_spec.rb +33 -38
- data/spec/wrapper_methods/get_user_collection_spec.rb +4 -9
- data/spec/wrapper_methods/get_user_folder_spec.rb +5 -10
- data/spec/wrapper_methods/get_user_folders_spec.rb +5 -10
- data/spec/wrapper_methods/get_user_inventory_spec.rb +5 -10
- data/spec/wrapper_methods/get_user_spec.rb +5 -10
- data/spec/wrapper_methods/get_user_wantlist_spec.rb +6 -11
- data/spec/wrapper_methods/search_spec.rb +8 -37
- data/spec/wrapper_spec.rb +47 -38
- metadata +55 -55
@@ -10,12 +10,7 @@ describe Discogs::Wrapper do
|
|
10
10
|
describe "when asking for label information" do
|
11
11
|
|
12
12
|
before do
|
13
|
-
|
14
|
-
@http_response = mock(Net::HTTPResponse, :code => "200", :body => read_sample("label"))
|
15
|
-
@http_response_as_file = mock(StringIO, :read => read_sample("label"))
|
16
|
-
Zlib::GzipReader.should_receive(:new).and_return(@http_response_as_file)
|
17
|
-
@http_request.should_receive(:start).and_return(@http_response)
|
18
|
-
Net::HTTP.should_receive(:new).and_return(@http_request)
|
13
|
+
mock_httparty("label")
|
19
14
|
|
20
15
|
@label = @wrapper.get_label(@label_id)
|
21
16
|
end
|
@@ -23,25 +18,25 @@ describe Discogs::Wrapper do
|
|
23
18
|
describe "when calling simple label attributes" do
|
24
19
|
|
25
20
|
it "should have a name attribute" do
|
26
|
-
@label.name.
|
21
|
+
expect(@label.name).to eq("Warner Bros. Records")
|
27
22
|
end
|
28
23
|
|
29
24
|
it "should have a releases_url attribute" do
|
30
|
-
@label.releases_url.
|
25
|
+
expect(@label.releases_url).to match(/labels\/1000\/releases/)
|
31
26
|
end
|
32
27
|
|
33
28
|
it "should have a profile attribute" do
|
34
|
-
@label.profile.
|
29
|
+
expect(@label.profile).to match(/Founded in 1958/)
|
35
30
|
end
|
36
31
|
|
37
32
|
it "should have a parent label attribute" do
|
38
|
-
@label.parent_label.name.
|
33
|
+
expect(@label.parent_label.name).to eq("Warner Music Group")
|
39
34
|
end
|
40
35
|
|
41
36
|
it "should have one or more URLs" do
|
42
|
-
@label.urls.
|
43
|
-
@label.urls[0].
|
44
|
-
@label.urls[1].
|
37
|
+
expect(@label.urls).to be_instance_of(Hashie::Array)
|
38
|
+
expect(@label.urls[0]).to eq("http://www.warnerbrosrecords.com/")
|
39
|
+
expect(@label.urls[1]).to eq("http://www.facebook.com/WarnerBrosRecords")
|
45
40
|
end
|
46
41
|
|
47
42
|
end
|
@@ -49,12 +44,12 @@ describe Discogs::Wrapper do
|
|
49
44
|
describe "when calling complex artist attributes" do
|
50
45
|
|
51
46
|
it "should have a traversible list of images" do
|
52
|
-
@label.images.
|
47
|
+
expect(@label.images).to be_instance_of(Hashie::Array)
|
53
48
|
end
|
54
49
|
|
55
50
|
it "should have a traversible list of sub-labels" do
|
56
|
-
@label.sublabels.
|
57
|
-
@label.sublabels[0].name.
|
51
|
+
expect(@label.sublabels).to be_instance_of(Hashie::Array)
|
52
|
+
expect(@label.sublabels[0].name).to eq("1017 Brick Squad Records")
|
58
53
|
end
|
59
54
|
|
60
55
|
it "should have specifications for each image" do
|
@@ -63,9 +58,9 @@ describe Discogs::Wrapper do
|
|
63
58
|
[ 500, 493, 'secondary' ] ]
|
64
59
|
|
65
60
|
@label.images.each_with_index do |image, index|
|
66
|
-
image.width.
|
67
|
-
image.height.
|
68
|
-
image.type.
|
61
|
+
expect(image.width).to eq(specs[index][0])
|
62
|
+
expect(image.height).to eq(specs[index][1])
|
63
|
+
expect(image.type).to eq(specs[index][2])
|
69
64
|
end
|
70
65
|
end
|
71
66
|
|
@@ -3,18 +3,25 @@ require 'spec_helper'
|
|
3
3
|
describe Discogs::Wrapper do
|
4
4
|
|
5
5
|
before do
|
6
|
-
@oauth_access_token =
|
7
|
-
@wrapper = Discogs::Wrapper.new("some_user_agent", @oauth_access_token)
|
6
|
+
@oauth_access_token = double(OAuth::AccessToken)
|
7
|
+
@wrapper = Discogs::Wrapper.new("some_user_agent", :access_token => @oauth_access_token)
|
8
|
+
|
8
9
|
@listing_id = 41578240
|
9
10
|
end
|
10
11
|
|
11
12
|
describe ".get_listing" do
|
12
13
|
|
13
14
|
before do
|
14
|
-
@oauth_response =
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
@oauth_response = double(OAuth::AccessToken)
|
16
|
+
|
17
|
+
allow(@oauth_response).to receive_messages(:code => "200", :body => read_sample("listing"))
|
18
|
+
|
19
|
+
@oauth_response_as_file = double(StringIO)
|
20
|
+
|
21
|
+
allow(@oauth_response_as_file).to receive_messages(:read => read_sample("listing"))
|
22
|
+
|
23
|
+
expect(Zlib::GzipReader).to receive(:new).and_return(@oauth_response_as_file)
|
24
|
+
expect(@oauth_access_token).to receive(:get).and_return(@oauth_response)
|
18
25
|
|
19
26
|
@listing = @wrapper.get_listing(@listing_id)
|
20
27
|
end
|
@@ -22,15 +29,15 @@ describe Discogs::Wrapper do
|
|
22
29
|
describe "when calling simple listing attributes" do
|
23
30
|
|
24
31
|
it "should have a username" do
|
25
|
-
@listing.status.
|
32
|
+
expect(@listing.status).to eq("For Sale")
|
26
33
|
end
|
27
34
|
|
28
35
|
it "should have a weight" do
|
29
|
-
@listing.weight.
|
36
|
+
expect(@listing.weight).to eq(239.0)
|
30
37
|
end
|
31
38
|
|
32
39
|
it "should have a seller" do
|
33
|
-
@listing.seller.username.
|
40
|
+
expect(@listing.seller.username).to eq("EmpireDVDs")
|
34
41
|
end
|
35
42
|
|
36
43
|
end
|
@@ -11,12 +11,7 @@ describe Discogs::Wrapper do
|
|
11
11
|
describe ".get_master_release" do
|
12
12
|
|
13
13
|
before do
|
14
|
-
|
15
|
-
@http_response = mock(Net::HTTPResponse, :code => "200", :body => read_sample("master_release"))
|
16
|
-
@http_response_as_file = mock(StringIO, :read => read_sample("master_release"))
|
17
|
-
Zlib::GzipReader.should_receive(:new).and_return(@http_response_as_file)
|
18
|
-
@http_request.should_receive(:start).and_return(@http_response)
|
19
|
-
Net::HTTP.should_receive(:new).and_return(@http_request)
|
14
|
+
mock_httparty("master_release")
|
20
15
|
|
21
16
|
@master_release = @wrapper.get_master_release(@master_release_id)
|
22
17
|
end
|
@@ -24,29 +19,29 @@ describe Discogs::Wrapper do
|
|
24
19
|
describe "when calling simple master release attributes" do
|
25
20
|
|
26
21
|
it "should have an ID attribute" do
|
27
|
-
@master_release.id.
|
22
|
+
expect(@master_release.id).to eq(9800)
|
28
23
|
end
|
29
24
|
|
30
25
|
it "should have a main_release attribute" do
|
31
|
-
@master_release.main_release.
|
26
|
+
expect(@master_release.main_release).to eq(5160870)
|
32
27
|
end
|
33
28
|
|
34
29
|
it "should have one or more tracks" do
|
35
|
-
@master_release.tracklist.
|
36
|
-
@master_release.tracklist[0].duration.
|
30
|
+
expect(@master_release.tracklist).to be_instance_of(Hashie::Array)
|
31
|
+
expect(@master_release.tracklist[0].duration).to eq("2:56")
|
37
32
|
end
|
38
33
|
|
39
34
|
it "should have one or more genres" do
|
40
|
-
@master_release.genres.
|
41
|
-
@master_release.genres[0].
|
35
|
+
expect(@master_release.genres).to be_instance_of(Hashie::Array)
|
36
|
+
expect(@master_release.genres[0]).to eq("Rock")
|
42
37
|
end
|
43
38
|
|
44
39
|
it "should have a versions_url" do
|
45
|
-
@master_release.versions_url.
|
40
|
+
expect(@master_release.versions_url).to match(/masters\/9800\/versions/)
|
46
41
|
end
|
47
42
|
|
48
43
|
it "should have one or more images" do
|
49
|
-
@master_release.images.
|
44
|
+
expect(@master_release.images).to be_instance_of(Hashie::Array)
|
50
45
|
end
|
51
46
|
|
52
47
|
end
|
@@ -56,20 +51,20 @@ describe Discogs::Wrapper do
|
|
56
51
|
it "should have specifications for each image" do
|
57
52
|
specs = [ [ 600, 607, 'primary' ], [ 600, 604, 'secondary' ], [ 600, 598, 'secondary' ], [ 600, 601, 'secondary' ] ]
|
58
53
|
@master_release.images.each_with_index do |image, index|
|
59
|
-
image.width.
|
60
|
-
image.height.
|
61
|
-
image.type.
|
54
|
+
expect(image.width).to eq(specs[index][0])
|
55
|
+
expect(image.height).to eq(specs[index][1])
|
56
|
+
expect(image.type).to eq(specs[index][2])
|
62
57
|
end
|
63
58
|
end
|
64
59
|
|
65
60
|
it "should have a traversible list of styles" do
|
66
|
-
@master_release.styles.
|
67
|
-
@master_release.styles[0].
|
61
|
+
expect(@master_release.styles).to be_instance_of(Hashie::Array)
|
62
|
+
expect(@master_release.styles[0]).to eq("Prog Rock")
|
68
63
|
end
|
69
64
|
|
70
65
|
it "should have an extra artist associated to the second track" do
|
71
|
-
@master_release.tracklist[1].extraartists.
|
72
|
-
@master_release.tracklist[1].extraartists[0].role.
|
66
|
+
expect(@master_release.tracklist[1].extraartists).to be_instance_of(Hashie::Array)
|
67
|
+
expect(@master_release.tracklist[1].extraartists[0].role).to eq("Lead Vocals")
|
73
68
|
end
|
74
69
|
|
75
70
|
end
|
@@ -10,12 +10,7 @@ describe Discogs::Wrapper do
|
|
10
10
|
describe ".get_master_release_versions" do
|
11
11
|
|
12
12
|
before do
|
13
|
-
|
14
|
-
@http_response = mock(Net::HTTPResponse, :code => "200", :body => read_sample("master_release_versions"))
|
15
|
-
@http_response_as_file = mock(StringIO, :read => read_sample("master_release_versions"))
|
16
|
-
Zlib::GzipReader.should_receive(:new).and_return(@http_response_as_file)
|
17
|
-
@http_request.should_receive(:start).and_return(@http_response)
|
18
|
-
Net::HTTP.should_receive(:new).and_return(@http_request)
|
13
|
+
mock_httparty("master_release_versions")
|
19
14
|
|
20
15
|
@master_versions = @wrapper.get_master_release_versions(@master_id)
|
21
16
|
end
|
@@ -23,23 +18,23 @@ describe Discogs::Wrapper do
|
|
23
18
|
describe "when calling simple master release versions attributes" do
|
24
19
|
|
25
20
|
it "should have 3 versions per page" do
|
26
|
-
@master_versions.versions.length.
|
21
|
+
expect(@master_versions.versions.length).to eq(3)
|
27
22
|
end
|
28
23
|
|
29
24
|
it "should have 3 versions total" do
|
30
|
-
@master_versions.pagination.items.
|
25
|
+
expect(@master_versions.pagination.items).to eq(3)
|
31
26
|
end
|
32
27
|
|
33
28
|
it "should have a first version with a label" do
|
34
|
-
@master_versions.versions.first.label.
|
29
|
+
expect(@master_versions.versions.first.label).to eq("Panton")
|
35
30
|
end
|
36
31
|
|
37
32
|
it "should have a first release with a released field" do
|
38
|
-
@master_versions.versions.first.released.
|
33
|
+
expect(@master_versions.versions.first.released).to eq("1982")
|
39
34
|
end
|
40
35
|
|
41
36
|
it "should not have a bogus attribute" do
|
42
|
-
|
37
|
+
expect(@master_versions.bogus_attribute).to be_nil
|
43
38
|
end
|
44
39
|
|
45
40
|
end
|
@@ -3,18 +3,25 @@ require 'spec_helper'
|
|
3
3
|
describe Discogs::Wrapper do
|
4
4
|
|
5
5
|
before do
|
6
|
-
@oauth_access_token =
|
7
|
-
@wrapper = Discogs::Wrapper.new("some_user_agent", @oauth_access_token)
|
6
|
+
@oauth_access_token = double(OAuth::AccessToken)
|
7
|
+
@wrapper = Discogs::Wrapper.new("some_user_agent", :access_token => @oauth_access_token)
|
8
|
+
|
8
9
|
@order_id = "1-1"
|
9
10
|
end
|
10
11
|
|
11
12
|
describe ".get_order_messages" do
|
12
13
|
|
13
14
|
before do
|
14
|
-
@oauth_response =
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
@oauth_response = double(OAuth::AccessToken)
|
16
|
+
|
17
|
+
allow(@oauth_response).to receive_messages(:code => "200", :body => read_sample("order_messages"))
|
18
|
+
|
19
|
+
@oauth_response_as_file = double(StringIO)
|
20
|
+
|
21
|
+
allow(@oauth_response_as_file).to receive_messages(:read => read_sample("order_messages"))
|
22
|
+
|
23
|
+
expect(Zlib::GzipReader).to receive(:new).and_return(@oauth_response_as_file)
|
24
|
+
expect(@oauth_access_token).to receive(:get).and_return(@oauth_response)
|
18
25
|
|
19
26
|
@order_messages = @wrapper.get_order_messages(@order_id)
|
20
27
|
end
|
@@ -22,11 +29,11 @@ describe Discogs::Wrapper do
|
|
22
29
|
describe "when calling simple order messages attributes" do
|
23
30
|
|
24
31
|
it "should have an array of messages" do
|
25
|
-
@order_messages.messages.
|
32
|
+
expect(@order_messages.messages).to be_instance_of(Hashie::Array)
|
26
33
|
end
|
27
34
|
|
28
35
|
it "should have a username for the first message" do
|
29
|
-
@order_messages.messages[0].from.username.
|
36
|
+
expect(@order_messages.messages[0].from.username).to eq("example_seller")
|
30
37
|
end
|
31
38
|
|
32
39
|
end
|
@@ -3,18 +3,25 @@ require 'spec_helper'
|
|
3
3
|
describe Discogs::Wrapper do
|
4
4
|
|
5
5
|
before do
|
6
|
-
@oauth_access_token =
|
7
|
-
@wrapper = Discogs::Wrapper.new("some_user_agent", @oauth_access_token)
|
6
|
+
@oauth_access_token = double(OAuth::AccessToken)
|
7
|
+
@wrapper = Discogs::Wrapper.new("some_user_agent", :access_token => @oauth_access_token)
|
8
|
+
|
8
9
|
@order_id = "1-1"
|
9
10
|
end
|
10
11
|
|
11
12
|
describe ".get_order" do
|
12
13
|
|
13
14
|
before do
|
14
|
-
@oauth_response =
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
@oauth_response = double(OAuth::AccessToken)
|
16
|
+
|
17
|
+
allow(@oauth_response).to receive_messages(:code => "200", :body => read_sample("order"))
|
18
|
+
|
19
|
+
@oauth_response_as_file = double(StringIO)
|
20
|
+
|
21
|
+
allow(@oauth_response_as_file).to receive_messages(:read => read_sample("order"))
|
22
|
+
|
23
|
+
expect(Zlib::GzipReader).to receive(:new).and_return(@oauth_response_as_file)
|
24
|
+
expect(@oauth_access_token).to receive(:get).and_return(@oauth_response)
|
18
25
|
|
19
26
|
@order = @wrapper.get_order(@order_id)
|
20
27
|
end
|
@@ -22,11 +29,11 @@ describe Discogs::Wrapper do
|
|
22
29
|
describe "when calling simple order attributes" do
|
23
30
|
|
24
31
|
it "should have a status" do
|
25
|
-
@order.status.
|
32
|
+
expect(@order.status).to eq("New Order")
|
26
33
|
end
|
27
34
|
|
28
35
|
it "should have a fee" do
|
29
|
-
@order.fee.value.
|
36
|
+
expect(@order.fee.value).to eq(2.52)
|
30
37
|
end
|
31
38
|
|
32
39
|
end
|
@@ -3,18 +3,25 @@ require 'spec_helper'
|
|
3
3
|
describe Discogs::Wrapper do
|
4
4
|
|
5
5
|
before do
|
6
|
-
@oauth_access_token =
|
7
|
-
@wrapper = Discogs::Wrapper.new("some_user_agent", @oauth_access_token)
|
6
|
+
@oauth_access_token = double(OAuth::AccessToken)
|
7
|
+
@wrapper = Discogs::Wrapper.new("some_user_agent", :access_token => @oauth_access_token)
|
8
|
+
|
8
9
|
@release_id = "1"
|
9
10
|
end
|
10
11
|
|
11
12
|
describe ".get_price_suggestions" do
|
12
13
|
|
13
14
|
before do
|
14
|
-
@oauth_response =
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
@oauth_response = double(OAuth::AccessToken)
|
16
|
+
|
17
|
+
allow(@oauth_response).to receive_messages(:code => "200", :body => read_sample("price_suggestions"))
|
18
|
+
|
19
|
+
@oauth_response_as_file = double(StringIO)
|
20
|
+
|
21
|
+
allow(@oauth_response_as_file).to receive_messages(:read => read_sample("price_suggestions"))
|
22
|
+
|
23
|
+
expect(Zlib::GzipReader).to receive(:new).and_return(@oauth_response_as_file)
|
24
|
+
expect(@oauth_access_token).to receive(:get).and_return(@oauth_response)
|
18
25
|
|
19
26
|
@price_suggestions = @wrapper.get_price_suggestions(@release_id)
|
20
27
|
end
|
@@ -22,11 +29,11 @@ describe Discogs::Wrapper do
|
|
22
29
|
describe "when calling simple price suggestion attributes" do
|
23
30
|
|
24
31
|
it "should have a block for Near Mint" do
|
25
|
-
@price_suggestions["Near Mint (NM or M-)"].
|
32
|
+
expect(@price_suggestions["Near Mint (NM or M-)"]).to_not be_nil
|
26
33
|
end
|
27
34
|
|
28
35
|
it "should have a price for Mint" do
|
29
|
-
@price_suggestions["Mint (M)"].value.
|
36
|
+
expect(@price_suggestions["Mint (M)"].value).to eq(14.319139100000001)
|
30
37
|
end
|
31
38
|
|
32
39
|
end
|
@@ -11,12 +11,7 @@ describe Discogs::Wrapper do
|
|
11
11
|
describe ".get_release" do
|
12
12
|
|
13
13
|
before do
|
14
|
-
|
15
|
-
@http_response = mock(Net::HTTPResponse, :code => "200", :body => read_sample("release"))
|
16
|
-
@http_response_as_file = mock(StringIO, :read => read_sample("release"))
|
17
|
-
Zlib::GzipReader.should_receive(:new).and_return(@http_response_as_file)
|
18
|
-
@http_request.should_receive(:start).and_return(@http_response)
|
19
|
-
Net::HTTP.should_receive(:new).and_return(@http_request)
|
14
|
+
mock_httparty("release")
|
20
15
|
|
21
16
|
@release = @wrapper.get_release(@release_id)
|
22
17
|
end
|
@@ -24,40 +19,40 @@ describe Discogs::Wrapper do
|
|
24
19
|
describe "when calling simple release attributes" do
|
25
20
|
|
26
21
|
it "should have a title attribute" do
|
27
|
-
@release.title.
|
22
|
+
expect(@release.title).to eq("Stockholm")
|
28
23
|
end
|
29
|
-
|
24
|
+
|
30
25
|
it "should have an ID attribute" do
|
31
|
-
@release.id.
|
26
|
+
expect(@release.id).to eq(1)
|
32
27
|
end
|
33
28
|
|
34
29
|
it "should have a master_id attribute" do
|
35
|
-
@release.master_id.
|
30
|
+
expect(@release.master_id).to eq(5427)
|
36
31
|
end
|
37
32
|
|
38
33
|
it "should have one or more extra artists" do
|
39
|
-
@release.extraartists.
|
40
|
-
@release.extraartists[0].id.
|
34
|
+
expect(@release.extraartists).to be_instance_of(Hashie::Array)
|
35
|
+
expect(@release.extraartists[0].id).to eq(239)
|
41
36
|
end
|
42
37
|
|
43
38
|
it "should have one or more tracks" do
|
44
|
-
@release.tracklist.
|
45
|
-
@release.tracklist[0].position.
|
39
|
+
expect(@release.tracklist).to be_instance_of(Hashie::Array)
|
40
|
+
expect(@release.tracklist[0].position).to eq("A")
|
46
41
|
end
|
47
|
-
|
42
|
+
|
48
43
|
it "should have one or more genres" do
|
49
|
-
@release.genres.
|
50
|
-
@release.genres[0].
|
44
|
+
expect(@release.genres).to be_instance_of(Hashie::Array)
|
45
|
+
expect(@release.genres[0]).to eq("Electronic")
|
51
46
|
end
|
52
47
|
|
53
48
|
it "should have one or more formats" do
|
54
|
-
@release.formats.
|
55
|
-
@release.formats[0].name.
|
49
|
+
expect(@release.formats).to be_instance_of(Hashie::Array)
|
50
|
+
expect(@release.formats[0].name).to eq("Vinyl")
|
56
51
|
end
|
57
52
|
|
58
53
|
it "should have one or more images" do
|
59
|
-
@release.images.
|
60
|
-
@release.images[0].type.
|
54
|
+
expect(@release.images).to be_instance_of(Hashie::Array)
|
55
|
+
expect(@release.images[0].type).to eq("primary")
|
61
56
|
end
|
62
57
|
|
63
58
|
end
|
@@ -67,9 +62,9 @@ describe Discogs::Wrapper do
|
|
67
62
|
it "should have specifications for each image" do
|
68
63
|
specs = [ [ 600, 600, 'primary' ], [ 600, 600, 'secondary' ], [ 600, 600, 'secondary' ], [ 600, 600, 'secondary' ] ]
|
69
64
|
@release.images.each_with_index do |image, index|
|
70
|
-
image.width.
|
71
|
-
image.height.
|
72
|
-
image.type.
|
65
|
+
expect(image.width).to eq(specs[index][0])
|
66
|
+
expect(image.height).to eq(specs[index][1])
|
67
|
+
expect(image.type).to eq(specs[index][2])
|
73
68
|
end
|
74
69
|
end
|
75
70
|
|
@@ -78,39 +73,39 @@ describe Discogs::Wrapper do
|
|
78
73
|
[ 290, true, 'http://www.youtube.com/watch?v=AHuQWcylaU4' ], [ 175, true, 'http://www.youtube.com/watch?v=sLZvvJVir5g' ],
|
79
74
|
[ 324, true, 'http://www.youtube.com/watch?v=js_g1qtPmL0' ], [ 289, true, 'http://www.youtube.com/watch?v=hy47qgyJeG0' ] ]
|
80
75
|
@release.videos.each_with_index do |video, index|
|
81
|
-
video.duration.
|
82
|
-
video.embed.
|
83
|
-
video.uri.
|
76
|
+
expect(video.duration).to eq(specs[index][0])
|
77
|
+
expect(video.embed).to eq(specs[index][1])
|
78
|
+
expect(video.uri).to eq(specs[index][2])
|
84
79
|
end
|
85
80
|
end
|
86
81
|
|
87
82
|
it "should have a traversible list of styles" do
|
88
|
-
@release.styles.
|
89
|
-
@release.styles[0].
|
83
|
+
expect(@release.styles).to be_instance_of(Hashie::Array)
|
84
|
+
expect(@release.styles[0]).to eq("Deep House")
|
90
85
|
end
|
91
86
|
|
92
87
|
it "should have a traversible list of labels" do
|
93
|
-
@release.styles.
|
94
|
-
@release.labels[0].catno.
|
95
|
-
@release.labels[0].name.
|
88
|
+
expect(@release.styles).to be_instance_of(Hashie::Array)
|
89
|
+
expect(@release.labels[0].catno).to eq("SK032")
|
90
|
+
expect(@release.labels[0].name).to eq("Svek")
|
96
91
|
end
|
97
92
|
|
98
93
|
it "should have a name and quantity for the first format" do
|
99
|
-
@release.formats.
|
100
|
-
@release.formats[0].name.
|
101
|
-
@release.formats[0].qty.
|
94
|
+
expect(@release.formats).to be_instance_of(Hashie::Array)
|
95
|
+
expect(@release.formats[0].name).to eq("Vinyl")
|
96
|
+
expect(@release.formats[0].qty).to eq("2")
|
102
97
|
end
|
103
98
|
|
104
99
|
it "should have a role associated to the first extra artist" do
|
105
|
-
@release.extraartists[0].role.
|
100
|
+
expect(@release.extraartists[0].role).to eq("Music By [All Tracks By]")
|
106
101
|
end
|
107
102
|
|
108
103
|
it "should have no artist associated to the third track" do
|
109
|
-
@release.tracklist[2].artists.
|
104
|
+
expect(@release.tracklist[2].artists).to be_nil
|
110
105
|
end
|
111
106
|
|
112
107
|
end
|
113
108
|
|
114
109
|
end
|
115
110
|
|
116
|
-
end
|
111
|
+
end
|