Sha256: 719316051a6de0e9032c44c2e9724e323335eb9e827bbc970c5fd4b57cc7b204
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
require 'spec_helper' describe 'OIA-PMH GetRecord Request' do let(:xml) { Nokogiri::XML(response.body) } let(:namespaces) do { dc: 'http://purl.org/dc/elements/1.1/', xmlns: 'http://www.openarchives.org/OAI/2.0/', oai_dc: 'http://www.openarchives.org/OAI/2.0/oai_dc/' } end before do get '/catalog/oai?verb=GetRecord&identifier=2007020969&metadataPrefix=oai_dc' end it 'contains header information' do expect(xml.at_xpath('//xmlns:GetRecord/xmlns:record/xmlns:header/xmlns:identifier').text).to eql 'oai:test:2007020969' expect(xml.at_xpath('//xmlns:GetRecord/xmlns:record/xmlns:header/xmlns:datestamp').text).to eql '2014-02-03T18:42:53Z' end it 'contains creator' do expect(xml.at_xpath('//xmlns:metadata/oai_dc:dc/dc:creator', namespaces).text).to eql 'Hearth, Amy Hill, 1958-' end it 'contains date' do expect(xml.at_xpath('//xmlns:metadata/oai_dc:dc/dc:date', namespaces).text).to eql '2008' end it 'contains subjects' do nodes = xml.xpath('//xmlns:metadata/oai_dc:dc/dc:subject', namespaces) expect(nodes.count).to be 4 expect(nodes.map(&:text)).to match_array ['Strong Medicine, 1922-', 'Delaware women', 'Indian women shamans', 'Delaware Indians'] end it 'contains title' do expect(xml.at_xpath('//xmlns:metadata/oai_dc:dc/dc:title', namespaces).text).to eql '"Strong Medicine speaks"' end it 'contains language' do expect(xml.at_xpath('//xmlns:metadata/oai_dc:dc/dc:language', namespaces).text).to eql 'English' end it 'contains format' do expect(xml.at_xpath('//xmlns:metadata/oai_dc:dc/dc:format', namespaces).text).to eql 'Book' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
blacklight_oai_provider-4.1.0 | spec/requests/get_record_spec.rb |