spec/isrc_spec.rb in isrc-1.0.2 vs spec/isrc_spec.rb in isrc-1.0.3
- old
+ new
@@ -27,10 +27,20 @@
# the better match seems to be: GB1209500610
# however, the length delta is huge
end
+ it "handles results with brackets" do
+ isrc.retrieve artist: 'Curiosity Killed The Cat', title: 'Down to Earth'
+ isrc.match(time:'03:54')[:isrc].should == 'GBF088600037'
+ end
+
+ it 'handles a mixed version of a song when there is not a mixed version listed' do
+ isrc.retrieve artist:'Kings of Leon', title: 'Use Somebody (Chew Fu Festival Fix)'
+ isrc.match(time:'5:37')[:isrc].should == 'USRC10800301'
+ end
+
it "handles edge cases that don't make sense" do
isrc.retrieve artist:'Toni Braxton', title:'Youre Making me High'
isrc.match(time:'4:12')[:isrc].should == 'USLF29600183'
end
@@ -47,37 +57,45 @@
isrc.retrieve artist:'Slut Puppies', title:'Funky Together'
isrc.match(time:'6:36')[:isrc].should == 'No Match'
end
context "song title processing" do
- it "should handle bracket mixes" do
- pieces = isrc.send(:extract_song_peices, "Surrender [Original Mix]")
- pieces.size.should == 2
- pieces.last.should == "[Original Mix]"
+ context 'of brackets' do
+ it "should parse them correctly with a one word song" do
+ pieces = isrc.send(:extract_song_peices, "Surrender [Original Mix]")
+ pieces[:all].size.should == 2
+ pieces[:all].last.should == "[Original Mix]"
+ pieces[:meta].size.should == 1
+ end
end
context 'of parenthesis' do
it "should count parenthesis as a single song peice" do
pieces = isrc.send(:extract_song_peices, "Want Me (Like Water) (New Vocal Mix No 1)")
- pieces.size.should == 4
- pieces.last.should == '(New Vocal Mix No 1)'
+ pieces[:all].size.should == 4
+ pieces[:all].last.should == '(New Vocal Mix No 1)'
+ pieces[:meta].size.should == 2
+ pieces[:title].size.should == 2
end
it "should handle a single word song with parenthesis" do
isrc.retrieve artist:'Niko', title: 'Womb (Flight Facilities feat. Giselle)'
isrc.match(time:'3:44')[:isrc].should == 'GBKNX0500003'
isrc = ISRC::PPLUK.new
isrc.retrieve artist:'Frank Sinatra', title: 'Chicago (Digitally Remastered)'
isrc.match(time:'2:14')[:isrc].should == 'USCA20300966'
# or USCA29800388; they are basically the same
+
+ # Bagatelle in A minor, WoO 59 -`Für Elise` by Bella Davidovich...
end
end
it "should handle a standard multi-word title" do
pieces = isrc.send(:extract_song_peices, "Take Your Time")
- pieces.size.should == 3
- pieces.last.should == "Time"
+ pieces[:all].size.should == 3
+ pieces[:title].size.should == 3
+ pieces[:title].last.should == "Time"
end
end
end
\ No newline at end of file