Sha256: db1890f976139fc533c8071d5aeaf7858224b13d25787c60bf45a6082a2e2077
Contents?: true
Size: 1.13 KB
Versions: 39
Compression:
Stored size: 1.13 KB
Contents
require 'spec_helper' describe Krikri::Enrichments::DedupNodes do it_behaves_like 'a field enrichment' let(:value) { build(:source_resource, creator: agents) } let(:agents) do [ build(:agent), agent_with_uri, 'moomin', ActiveTriples::Resource.new('http://example.org'), Date.today ] end let(:agent_with_uri) do agent = build(:agent) agent.set_subject! 'http://example.org/moomin' agent end context 'with duplicate values' do before { agents << build(:agent) } it 'returns original node' do expect(subject.enrich_value(value).rdf_subject).to eq value.rdf_subject end it 'removes duplicate nodes' do expect(subject.enrich_value(value).creator) .to contain_exactly(*agents[0..-2]) end it 'ignores other nodes' do expect(subject.enrich_value(value).contributor) .to contain_exactly(*value.contributor) end end it 'returns an isomorphic graph' do expect(subject.enrich_value(value)).to be_isomorphic_with value end it 'leaves literal values unaltered' do expect(subject.enrich_value('moomin')).to eq 'moomin' end end
Version data entries
39 entries across 39 versions & 1 rubygems