Sha256: ce8645a0312b36b0c44d548e82e8177d6f35811514e7e11fc5fe8607d68618b8

Contents?: true

Size: 1.66 KB

Versions: 1

Compression:

Stored size: 1.66 KB

Contents

require 'spec_helper'

describe DPLA::MAP::SourceResource do

  subject { build(:source_resource) }

  it 'is a dpla:SourceResource' do
    expect(subject.type).to eq [RDF::URI('http://dp.la/about/map/SourceResource')]
  end

  it 'has an edm:hasType that is a DPLA::MAP::Controlled::Genre' do
    expect(subject.genre).to contain_exactly(an_instance_of(DPLA::MAP::Controlled::Genre))
  end

  it 'has a dcterms:language that is a DPLA::MAP::Controlled::Language' do
    expect(subject.language).to contain_exactly(an_instance_of(DPLA::MAP::Controlled::Language))
  end

  it 'has a dcterms:subject that is a DPLA::MAP::Concept' do
    expect(subject.subject).to contain_exactly(an_instance_of(DPLA::MAP::Concept))
  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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dpla-map-4.0.0.0.pre.12 spec/lib/dpla_spec.rb