Use magic encoding to ret rid of "invalid multibyte chat (US-ASCII)" errors. track_search is now renamed recording_search. recording_search now works (I mixed up the inputs).

This commit is contained in:
Thomas Wolfe
2013-11-05 20:15:09 -06:00
committed by Diego d'Ursel
parent 813b6f0383
commit 2d4c1c42fd
42 changed files with 151 additions and 42 deletions
@@ -1,10 +1,10 @@
# -*- encoding: utf-8 -*-
# -*- encoding : utf-8 -*-
require "spec_helper"
describe MusicBrainz::Bindings::TrackSearch do
describe MusicBrainz::Bindings::RecordingSearch do
describe '.parse' do
it "gets correct Track (really recording) data" do
it "gets correct Recording data" do
response = '<metadata xmlns="http://musicbrainz.org/ns/mmd-2.0#" xmlns:ext="http://musicbrainz.org/ns/ext#-2.0"><recording-list offset="0" count="1"><recording id="0b382a13-32f0-4743-9248-ba5536a6115e" ext:score="100"><title>King Fred</title><artist-credit><name-credit><artist id="f52f7a92-d495-4d32-89e7-8b1e5b8541c8"><name>Too Much Joy</name></artist></name-credit></artist-credit><release-list><release id="8442e42b-c40a-4817-89a0-dbe663c94d2d"><title>Green Eggs and Crack</title></release></release-list></recording></recording-list></metadata>'
expect(described_class.parse(Nokogiri::XML.parse(response).remove_namespaces!.xpath('/metadata'))).to eq [
{
+1 -1
View File
@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- encoding : utf-8 -*-
require "spec_helper"
+1 -1
View File
@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- encoding : utf-8 -*-
require "spec_helper"
+1 -1
View File
@@ -1,4 +1,4 @@
# encoding: utf-8
# -*- encoding : utf-8 -*-
require "ostruct"
require "spec_helper"
+1 -1
View File
@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- encoding : utf-8 -*-
require "spec_helper"
+1 -1
View File
@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- encoding : utf-8 -*-
require "spec_helper"
+1 -1
View File
@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- encoding : utf-8 -*-
require "spec_helper"
+1 -1
View File
@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- encoding : utf-8 -*-
require "spec_helper"
+32
View File
@@ -0,0 +1,32 @@
# -*- encoding: utf-8 -*-
require "spec_helper"
describe MusicBrainz::Recording do
describe '.find' do
it "gets no exception while loading release info" do
lambda {
MusicBrainz::Recording.find("b3015bab-1540-4d4e-9f30-14872a1525f7")
}.should_not raise_error(Exception)
end
it "gets correct instance" do
track = MusicBrainz::Recording.find("b3015bab-1540-4d4e-9f30-14872a1525f7")
track.should be_an_instance_of(MusicBrainz::Recording)
end
it "gets correct track data" do
track = MusicBrainz::Recording.find("b3015bab-1540-4d4e-9f30-14872a1525f7")
track.title.should == "Empire"
end
end
describe '.search' do
it "searches tracks (aka recordings) by artist name and title" do
matches = MusicBrainz::Recording.search('Bound for the floor', 'Local H')
matches.length.should be > 0
matches.first[:title].should == "Bound for the Floor"
matches.first[:artist].should == "Local H"
end
end
end
+1 -1
View File
@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- encoding : utf-8 -*-
require "spec_helper"
+1 -1
View File
@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- encoding : utf-8 -*-
require "spec_helper"
+1 -10
View File
@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- encoding : utf-8 -*-
require "spec_helper"
@@ -22,13 +22,4 @@ describe MusicBrainz::Track do
track.length.should == 233013
end
end
describe '.search' do
it "searches tracks (aka recordings) by artist name and title" do
matches = MusicBrainz::Track.search('Local H', 'Bound for the floor')
matches.length.should be > 0
matches.first[:title].should == 'Empire'
matches.first[:type].should == 'Album'
end
end
end
+1
View File
@@ -1,3 +1,4 @@
# -*- encoding : utf-8 -*-
require "rubygems"
require "bundler/setup"
require "musicbrainz"