Update to use modern RSpec syntax and conventions
* Replace `should` syntax with `expect` syntax. * Add pry as a development dependency. * Fix failing specs.
This commit is contained in:
@@ -15,11 +15,11 @@ describe MusicBrainz::Bindings::Relations do
|
||||
</relation>
|
||||
</relation-list></artist>}
|
||||
)
|
||||
|
||||
described_class.parse(xml.xpath('./artist'))[:urls][:social_network].should == 'https://plus.google.com/+Madonna'
|
||||
|
||||
expect(described_class.parse(xml.xpath('./artist'))[:urls][:social_network]).to eq 'https://plus.google.com/+Madonna'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context 'multiple urls for relation types' do
|
||||
it 'returns an array' do
|
||||
xml = Nokogiri::XML.parse(
|
||||
@@ -33,7 +33,7 @@ describe MusicBrainz::Bindings::Relations do
|
||||
</relation-list></artist>}
|
||||
)
|
||||
|
||||
described_class.parse(xml.xpath('./artist'))[:urls][:social_network].should == [
|
||||
expect(described_class.parse(xml.xpath('./artist'))[:urls][:social_network]).to eq [
|
||||
'https://plus.google.com/+Madonna', 'https://www.facebook.com/madonna'
|
||||
]
|
||||
end
|
||||
@@ -41,4 +41,4 @@ describe MusicBrainz::Bindings::Relations do
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,14 +4,20 @@ require "spec_helper"
|
||||
|
||||
describe MusicBrainz::Bindings::ReleaseGroupSearch do
|
||||
describe '.parse' do
|
||||
let(:response) {
|
||||
'<metadata xmlns="http://musicbrainz.org/ns/mmd-2.0#" xmlns:ext="http://musicbrainz.org/ns/ext#-2.0"><release-group-list><release-group id="246bc928-2dc8-35ba-80ee-7a0079de1632" type="Single" ext:score="100"><title>Empire</title></release-group></release-group-list></metadata>'
|
||||
}
|
||||
let(:metadata) {
|
||||
described_class.parse(Nokogiri::XML.parse(response).remove_namespaces!.xpath('/metadata'))
|
||||
}
|
||||
|
||||
it "gets correct release group data" do
|
||||
response = '<metadata xmlns="http://musicbrainz.org/ns/mmd-2.0#" xmlns:ext="http://musicbrainz.org/ns/ext#-2.0"><release-group-list><release-group id="246bc928-2dc8-35ba-80ee-7a0079de1632" type="Single" ext:score="100"><title>Empire</title></release-group></release-group-list></metadata>'
|
||||
described_class.parse(Nokogiri::XML.parse(response).remove_namespaces!.xpath('/metadata')).should == [
|
||||
expect(metadata).to eq([
|
||||
{
|
||||
id: '246bc928-2dc8-35ba-80ee-7a0079de1632', mbid: '246bc928-2dc8-35ba-80ee-7a0079de1632',
|
||||
id: '246bc928-2dc8-35ba-80ee-7a0079de1632', mbid: '246bc928-2dc8-35ba-80ee-7a0079de1632',
|
||||
title: 'Empire', type: 'Single', score: 100
|
||||
}
|
||||
]
|
||||
])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,34 +10,34 @@ describe MusicBrainz::Bindings::Release do
|
||||
it 'returns CD' do
|
||||
response = '<release><medium-list count="1"><medium><format>CD</format></medium></medium-list></release>'
|
||||
xml = Nokogiri::XML.parse(response)
|
||||
described_class.parse(xml)[:format].should == 'CD'
|
||||
expect(described_class.parse(xml)[:format]).to eq 'CD'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context 'multiple cds' do
|
||||
it 'returns 2xCD' do
|
||||
response = '<release><medium-list count="2"><medium><format>CD</format><track-list count="11" /></medium><medium><title>bonus disc</title><format>CD</format></medium></medium-list></release>'
|
||||
xml = Nokogiri::XML.parse(response)
|
||||
described_class.parse(xml)[:format].should == '2xCD'
|
||||
expect(described_class.parse(xml)[:format]).to eq '2xCD'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context 'different formats' do
|
||||
it 'returns DVD + CD' do
|
||||
response = '<release><medium-list count="2"><medium><format>DVD</format></medium><medium><format>CD</format></medium></medium-list></release>'
|
||||
xml = Nokogiri::XML.parse(response)
|
||||
described_class.parse(xml)[:format].should == 'DVD + CD'
|
||||
expect(described_class.parse(xml)[:format]).to eq 'DVD + CD'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context 'different formats plus multiple mediums with same format' do
|
||||
it 'returns 2xCD + DVD' do
|
||||
response = '<release><medium-list count="2"><medium><format>CD</format></medium><medium><format>CD</format></medium><medium><format>DVD</format></medium></medium-list></release>'
|
||||
xml = Nokogiri::XML.parse(response)
|
||||
described_class.parse(xml)[:format].should == '2xCD + DVD'
|
||||
expect(described_class.parse(xml)[:format]).to eq '2xCD + DVD'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,9 +6,9 @@ describe MusicBrainz::Bindings::TrackSearch do
|
||||
describe '.parse' do
|
||||
it "gets correct Track (really 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>'
|
||||
described_class.parse(Nokogiri::XML.parse(response).remove_namespaces!.xpath('/metadata')).should == [
|
||||
expect(described_class.parse(Nokogiri::XML.parse(response).remove_namespaces!.xpath('/metadata'))).to eq [
|
||||
{
|
||||
id: '0b382a13-32f0-4743-9248-ba5536a6115e', mbid: '0b382a13-32f0-4743-9248-ba5536a6115e',
|
||||
id: '0b382a13-32f0-4743-9248-ba5536a6115e', mbid: '0b382a13-32f0-4743-9248-ba5536a6115e',
|
||||
title: 'King Fred', artist: 'Too Much Joy', releases: ['Green Eggs and Crack'], score: 100
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user