Sha256: a98b2fb313dd49fdc6e0cc05e27ba84507a60e0d401c8fb34952f4e4f218fa61

Contents?: true

Size: 1.1 KB

Versions: 8

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

RSpec.describe Sufia::ResourceSync::CapabilityListWriter do
  let(:sitemap) { 'http://www.sitemaps.org/schemas/sitemap/0.9' }
  let(:rs) { 'http://www.openarchives.org/rs/terms/' }

  let(:resource_list) { 'http://example.com/resourcelist.xml' }
  let(:description) { 'http://example.com/resourcesync_description.xml' }

  subject do
    described_class.new(resource_list_url: resource_list,
                        description_url: description).write
  end
  let(:xml) { Nokogiri::XML.parse(subject) }

  it "has url to the capability list" do
    description_href = xml.xpath('/x:urlset/rs:ln[@rel="up"]/@href', 'x' => sitemap, 'rs' => rs).map(&:value)
    expect(description_href).to eq [description]

    capability = xml.xpath('/x:urlset/rs:md/@capability', 'x' => sitemap, 'rs' => rs).map(&:value)
    expect(capability).to eq ["capabilitylist"]

    url = xml.xpath('//x:url[1]/x:loc', 'x' => sitemap).text
    expect(url).to eq resource_list
    capability = xml.xpath('//x:url[1]/rs:md/@capability', 'x' => sitemap, 'rs' => rs).map(&:value)
    expect(capability).to eq ["resourcelist"]
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sufia-7.4.1 spec/lib/sufia/resource_sync/capability_list_writer_spec.rb
sufia-7.4.0 spec/lib/sufia/resource_sync/capability_list_writer_spec.rb
sufia-7.3.1 spec/lib/sufia/resource_sync/capability_list_writer_spec.rb
sufia-7.3.0 spec/lib/sufia/resource_sync/capability_list_writer_spec.rb
sufia-7.3.0.rc3 spec/lib/sufia/resource_sync/capability_list_writer_spec.rb
sufia-7.3.0.rc2 spec/lib/sufia/resource_sync/capability_list_writer_spec.rb
sufia-7.3.0.rc1 spec/lib/sufia/resource_sync/capability_list_writer_spec.rb
sufia-7.2.0 spec/lib/sufia/resource_sync/capability_list_writer_spec.rb