Sha256: d65ea28f2ce0433949d9a6f9a2f9993a89602608158093efd8d4c2f4b2aac7a8
Contents?: true
Size: 1.21 KB
Versions: 34
Compression:
Stored size: 1.21 KB
Contents
require 'spec_helper' describe Krikri::XmlParser do subject { Krikri::XmlParser.new(record) } let(:record) { build(:oai_dc_record) } it_behaves_like 'a parser' context 'with a root path' do subject { Krikri::XmlParser.new(record, '//oai_dc:dc') } it_behaves_like 'a parser' end context 'with no root path' do subject { Krikri::XmlParser.new(record, '//oai_dc:fake_root') } it 'raises an error' do expect { subject }.to raise_error described_class::EmptyRootNodeError end end end describe Krikri::XmlParser::Value do subject { Krikri::XmlParser.new(record).root } let(:record) { build(:oai_dc_record) } it_behaves_like 'a parser value' it_behaves_like 'a parser value that has attributes' context 'with a root path' do subject { Krikri::XmlParser.new(record, '//oai_dc:dc').root } it 'allows boolean "or" with "|" in the field name' do expect(subject['dc:notdefined|dc:type'].values).to eq ["model"] end it 'returns the value from the first defined name, given a "|"' do # "dc:type" comes last in the document, but comes first in the "|" # expression: expect(subject['dc:type|dc:title'].values) .to eq ["model"] end end end
Version data entries
34 entries across 34 versions & 1 rubygems