Sha256: e384651d8609bdbdc0ebb65ffa3b4db5b4adba201d42838d22af3022124e9fa9
Contents?: true
Size: 1.64 KB
Versions: 15
Compression:
Stored size: 1.64 KB
Contents
require 'spec_helper' require_relative 'shared/base_resource_list_examples' require_relative 'shared/augmented_examples' module Resync describe SourceDescription do it_behaves_like BaseResourceList it_behaves_like Augmented describe 'XML conversion' do describe '#from_xml' do it 'parses an XML string' do data = File.read('spec/data/examples/example-12.xml') list = SourceDescription.load_from_xml(XML.element(data)) links = list.links expect(links.size).to eq(1) link = links[0] expect(link.rel).to eq('describedby') expect(link.uri).to eq(URI('http://example.com/info_about_source.xml')) md = list.metadata expect(md.capability).to eq('description') urls = list.resources expect(urls.size).to eq(3) (0..2).each do |i| url = urls[i] expect(url.uri).to eq(URI("http://example.com/capabilitylist#{i + 1}.xml")) md = url.metadata expect(md.capability).to eq('capabilitylist') links = url.links expect(links.size).to eq(1) link = links[0] expect(link.rel).to eq('describedby') expect(link.uri).to eq(URI("http://example.com/info_about_set#{i + 1}_of_resources.xml")) end end end describe '#save_to_xml' do it 'can round-trip to XML' do data = File.read('spec/data/examples/example-12.xml') list = SourceDescription.load_from_xml(XML.element(data)) xml = list.save_to_xml expect(xml).to be_xml(data) end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems