Sha256: 9cc950e6469172f3c31e71f473a41eaa13a6a5b2e4f6f187ea5a8c16caab2082

Contents?: true

Size: 1.71 KB

Versions: 3

Compression:

Stored size: 1.71 KB

Contents

require 'spec_helper'

describe NewspaperWorks::Ingest do
  describe "Ingest module methods" do
    it "gets default admin set" do
      admin_set = described_class.find_admin_set
      expect(admin_set).to be_an AdminSet
      expect(admin_set.id).to eq AdminSet::DEFAULT_ID
    end

    # initial expectations of a just-created work without administrative
    #   metadata set yet; AKA the "before" picture
    def expect_initial_work_state(work)
      expect(work.admin_set).to be_nil
      expect(work.depositor).to be_nil
      expect(work.visibility).to eq 'restricted'
      expect(work.date_modified).to be_nil
      expect(work.date_uploaded).to be_nil
      expect(work.resource_type).to be_empty
      expect(work.state).to be_nil
    end

    it "sets default assigned metadata for a work" do
      work = NewspaperTitle.create!(title: ["hello"])
      expect_initial_work_state(work)
      described_class.assign_administrative_metadata(work)
      expect(work.admin_set).to eq AdminSet.find(AdminSet::DEFAULT_ID)
      expect(work.depositor).to eq User.batch_user.user_key
      expect(work.visibility).to eq 'open'
      expect(work.state).to be_an ActiveTriples::Resource
      expect(work.state.to_uri.to_s).to eq \
        'http://fedora.info/definitions/1/0/access/ObjState#active'
      expect(work.date_uploaded).to be_a DateTime
      expect(work.date_modified).to eq work.date_uploaded
      expect(work.resource_type).to match_array ['Newspapers']
    end

    it "has method to get publication metadata for lccn" do
      lccn = 'sn84038814'
      metadata = described_class.publication_metadata(lccn)
      expect(metadata).to be_a NewspaperWorks::Ingest::PublicationInfo
      expect(metadata.lccn).to eq lccn
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
newspaper_works-1.0.1 spec/lib/newspaper_works/ingest_spec.rb
newspaper_works-1.0.0 spec/lib/newspaper_works/ingest_spec.rb
newspaper_works-0.1.0 spec/lib/newspaper_works/ingest_spec.rb