diff --git a/spec/fixtures/release/list.xml b/spec/fixtures/release/list.xml new file mode 100644 index 0000000..e0329da --- /dev/null +++ b/spec/fixtures/release/list.xml @@ -0,0 +1,344 @@ + + + + + Empire + Official + normal + Jewel Case + + eng + + + + Empire + 2006-08-28 + Album + + 2006 + XE + + + 2006 + + Europe + Europe + + XE + + + + + 828768934227 + + false + 0 + false + false + + + + 1 + CD + + + + + + Empire + Official + normal + + eng + + + + Empire + 2006-08-28 + Album + + 2006-08-28 + GB + + + 2006-08-28 + + United Kingdom + United Kingdom + + GB + + + + + B000H49P28 + + false + 0 + false + false + + + + 1 + + + + + + Empire + Official + normal + + eng + + + + Empire + 2006-08-28 + Album + + 2006-09-19 + US + + + 2006-09-19 + + United States + United States + + US + + + + + 828768832325 + B000HEVYQS + + false + 0 + false + false + + + + 1 + CD + + + + + + Empire + Official + normal + + eng + + + + Empire + 2006-08-28 + Album + + 2006-09-22 + XW + + + 2006-09-22 + + [Worldwide] + [Worldwide] + + XW + + + + + + false + 0 + false + false + + + + 1 + Digital Media + + + + + + Empire + Official + normal + + eng + + + + Empire + 2006-08-28 + Album + + 2006-08-28 + GB + + + 2006-08-28 + + United Kingdom + United Kingdom + + GB + + + + + 828768849927 + B000H49P28 + + false + 0 + false + false + + + + 1 + CD + + + + + + Empire + Official + normal + Jewel Case + + eng + + + + Empire + 2006-08-28 + Album + + 2006 + GB + + + 2006 + + United Kingdom + United Kingdom + + GB + + + + + 828768934227 + + false + 0 + false + false + + + + 1 + CD + + + + + + Empire + Official + normal + + eng + + + + Empire + 2006-08-28 + Album + + 2006-12-20 + JP + + + 2006-12-20 + + Japan + Japan + + JP + + + + + 4988017645901 + B000K2QL9W + + false + 0 + false + false + + + + 1 + CD + + + + + + Empire + Official + normal + Jewel Case + + eng + + + + Empire + 2006-08-28 + Album + + 2006-12-18 + GB + + + 2006-12-18 + + United Kingdom + United Kingdom + + GB + + + + + + true + 1 + true + false + + + + 1 + Digital Media + + + + + + \ No newline at end of file diff --git a/spec/models/release_group_spec.rb b/spec/models/release_group_spec.rb index 7afacfe..7e6c991 100644 --- a/spec/models/release_group_spec.rb +++ b/spec/models/release_group_spec.rb @@ -66,9 +66,15 @@ describe MusicBrainz::ReleaseGroup do describe '#releases' do it "gets correct release group's releases" do + MusicBrainz::Client.any_instance.stub(:get_contents).with('http://musicbrainz.org/ws/2/release-group/6f33e0f0-cde2-38f9-9aee-2c60af8d1a61?inc=url-rels'). + and_return({ status: 200, body: File.open(File.join(File.dirname(__FILE__), "../fixtures/release_group/entity.xml")).read}) + + MusicBrainz::Client.any_instance.stub(:get_contents).with('http://musicbrainz.org/ws/2/release?release-group=6f33e0f0-cde2-38f9-9aee-2c60af8d1a61&inc=media+release-groups&limit=100'). + and_return({ status: 200, body: File.open(File.join(File.dirname(__FILE__), "../fixtures/release/list.xml")).read}) + releases = MusicBrainz::ReleaseGroup.find("6f33e0f0-cde2-38f9-9aee-2c60af8d1a61").releases releases.length.should be >= 5 - releases.first.id.should == "2225dd4c-ae9a-403b-8ea0-9e05014c778f" + releases.first.id.should == "30d5e730-ce0a-464d-93e1-7d76e4bb3e31" releases.first.status.should == "Official" releases.first.title.should == "Empire" releases.first.date.should == Date.new(2006, 8, 28)