spec/requests/artist_spec.rb in musicbrainz-0.5.2 vs spec/requests/artist_spec.rb in musicbrainz-0.6.0
- old
+ new
@@ -1,44 +1,49 @@
-require 'spec_helper'
+require "spec_helper"
-describe "artist" do
- it "return valid instance", :vcr do
- artist = MusicBrainz::Artist.find('69b39eab-6577-46a4-a9f5-817839092033')
- artist.should be_a_kind_of(MusicBrainz::Artist)
+describe MusicBrainz::Artist do
+ it "gets no exception while loading artist info" do
+ lambda {
+ MusicBrainz::Artist.find('69b39eab-6577-46a4-a9f5-817839092033')
+ }.should_not raise_error(Exception)
end
-
- it "search by name", :vcr do
+
+ it "gets correct instance" do
+ artist = MusicBrainz::Artist.find_by_name('Kasabian')
+ artist.should be_an_instance_of(MusicBrainz::Artist)
+ end
+
+ it "searches artist by name" do
matches = MusicBrainz::Artist.search('Kasabian')
- matches.should have_at_least(1).item
- matches.first[:name].should eql('Kasabian')
+ matches.length.should be > 0
+ matches.first[:name].should == "Kasabian"
end
- #
- # should "get correct result by name" do
- # @artist = MusicBrainz::Artist.find_by_name('Kasabian')
- # assert_equal("69b39eab-6577-46a4-a9f5-817839092033", @artist.id)
- # end
- #
- # setup do
- # @artist = MusicBrainz::Artist.find('69b39eab-6577-46a4-a9f5-817839092033')
- # end
- #
- # should "return valid instance" do
- # assert_instance_of(MusicBrainz::Artist, @artist)
- # end
- #
- # should "contain correct data" do
- # assert_equal("69b39eab-6577-46a4-a9f5-817839092033", @artist.id)
- # assert_equal("Group", @artist.type)
- # assert_equal("Kasabian", @artist.name)
- # assert_equal("GB", @artist.country)
- # assert_equal("1999", @artist.date_begin)
- # end
- #
- # should "load release groups" do
- # release_groups = @artist.release_groups
- # assert_operator(16, :<=, release_groups.length)
- # assert_equal('533cbc5f-ec7e-32ab-95f3-8d1f804a5176', release_groups.first.id)
- # assert_equal('Single', release_groups.first.type)
- # assert_equal('Club Foot', release_groups.first.title)
- # assert_equal(Time.utc(2004, 5, 10), release_groups.first.first_release_date)
- # end
+
+ it "finds name first than alias" do
+ matches = MusicBrainz::Artist.search('Chris Martin')
+ matches.length.should be > 0
+ matches.first[:name].should == "Chris Martin"
+ end
+
+ it "gets correct result by name" do
+ artist = MusicBrainz::Artist.find_by_name('Kasabian')
+ artist.id.should == "69b39eab-6577-46a4-a9f5-817839092033"
+ end
+
+ it "gets correct artist data" do
+ artist = MusicBrainz::Artist.find_by_name('Kasabian')
+ artist.id.should == "69b39eab-6577-46a4-a9f5-817839092033"
+ artist.type.should == "Group"
+ artist.name.should == "Kasabian"
+ artist.country.should == "GB"
+ artist.date_begin.should == "1999"
+ end
+
+ it "gets correct artist's release groups" do
+ release_groups = MusicBrainz::Artist.find_by_name('Kasabian').release_groups
+ release_groups.length.should be >= 16
+ release_groups.first.id.should == "533cbc5f-ec7e-32ab-95f3-8d1f804a5176"
+ release_groups.first.type.should == "Single"
+ release_groups.first.title.should == "Club Foot"
+ release_groups.first.first_release_date.should == Time.utc(2004, 5, 10)
+ end
end