# -*- encoding: utf-8 -*- require "spec_helper" describe MusicBrainz::Bindings::Relations do describe '.parse' do describe 'attributes' do describe 'urls' do context '1 url for relation type' do it 'returns a string' do xml = Nokogiri::XML.parse( %Q{ 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( %Q{ https://plus.google.com/+Madonna https://www.facebook.com/madonna } ) expect(described_class.parse(xml.xpath('./artist'))[:urls][:social_network]).to eq [ 'https://plus.google.com/+Madonna', 'https://www.facebook.com/madonna' ] end end end end end end