spec/lib/dpla_spec.rb in dpla-map-4.0.0.0.pre.11 vs spec/lib/dpla_spec.rb in dpla-map-4.0.0.0.pre.12
- old
+ new
@@ -21,6 +21,37 @@
end
it 'has a dcterms:type that is a DPLA::MAP::Controlled::DCMIType' do
expect(subject.dctype).to contain_exactly(an_instance_of(DPLA::MAP::Controlled::DCMIType))
end
-end
\ No newline at end of file
+end
+
+describe DPLA::MAP::Aggregation do
+ subject { build(:aggregation) }
+
+ it 'has nested values' do
+ expect(subject.sourceResource.first.subject.first.prefLabel)
+ .to contain_exactly('Gay activists')
+ end
+
+ context 'when built from parsed graph' do
+ let(:parsed) do
+ lang = DPLA::MAP::Controlled::Language.new
+ lang.providedLabel = label
+ subject.sourceResource.first.language = lang
+
+ uri = RDF::URI('http://example.org/moomin')
+ subject.set_subject!(uri)
+
+ agg = DPLA::MAP::Aggregation.new(uri)
+ agg << RDF::Reader.for(:ttl).new(subject.dump(:ttl))
+ agg
+ end
+
+ let(:label) { 'eng' }
+
+ it 'has nested values' do
+ expect(parsed.sourceResource.first.language.first.providedLabel)
+ .to contain_exactly(label)
+ end
+ end
+end