Sha256: aa8f09e6de2f7e4d8b11fda34e58801d56349a36b1819f6c527fd718d460988d
Contents?: true
Size: 1.16 KB
Versions: 36
Compression:
Stored size: 1.16 KB
Contents
require 'spec_helper' describe Krikri::JsonParser do subject { Krikri::JsonParser.new(record) } let(:record) { build(:json_record) } it_behaves_like 'a parser' context 'with a root path that specifies an array' do subject { Krikri::JsonParser.new(record, '$.contributor') } it_behaves_like 'a parser' end context 'with a root path with that specifies a key in an array' do subject { Krikri::JsonParser.new(record, '$.contributor[0]') } it_behaves_like 'a parser' end context 'with a root path that specifies an object' do subject { Krikri::JsonParser.new(record, '$.translations') } it_behaves_like 'a parser' end end describe Krikri::JsonParser::Value do subject { Krikri::JsonParser.new(record).root } let(:record) { build(:json_record) } it_behaves_like 'a parser value' it 'allows boolean "or" with "|" in the field name' do expect(subject['notdefined|subject'].values).to eq ["Moomin Papa"] end it 'returns the value from the first defined name, given a "|"' do # "subject" comes last in the document, but first in the "|" expression: expect(subject['subject|title'].values).to eq ["Moomin Papa"] end end
Version data entries
36 entries across 36 versions & 1 rubygems