# -*- encoding : utf-8 -*-
require "spec_helper"
describe MusicBrainz::Bindings::Release do
describe '.parse' do
describe 'attributes' do
describe 'format' do
context 'single cd' do
it 'returns CD' do
response = 'CD'
xml = Nokogiri::XML.parse(response)
expect(described_class.parse(xml)[:format]).to eq 'CD'
end
end
context 'multiple cds' do
it 'returns 2xCD' do
response = 'CDbonus discCD'
xml = Nokogiri::XML.parse(response)
expect(described_class.parse(xml)[:format]).to eq '2xCD'
end
end
context 'different formats' do
it 'returns DVD + CD' do
response = 'DVDCD'
xml = Nokogiri::XML.parse(response)
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 = 'CDCDDVD'
xml = Nokogiri::XML.parse(response)
expect(described_class.parse(xml)[:format]).to eq '2xCD + DVD'
end
end
end
end
end
end