Sha256: 7859f57669d41db97c68734050a4b0ad9942e1e6737a37ad20fb1d289b8852ab

Contents?: true

Size: 1.39 KB

Versions: 3

Compression:

Stored size: 1.39 KB

Contents

require 'spec_helper'
require 'ndnp_shared'

RSpec.describe NewspaperWorks::Ingest::NDNP::ContainerIngest do
  include_context "ndnp fixture setup"

  describe "sample fixture 'batch_test_ver01'" do
    let(:reel) { described_class.new(reel1) }

    it "gets metadata" do
      expect(reel.metadata).to be_a \
        NewspaperWorks::Ingest::NDNP::ContainerMetadata
      # uses same Nokogiri document context:
      expect(reel.metadata.doc).to be reel.doc
      # has identifier method equivalent to reel number
      expect(reel.identifier).to eq reel.metadata.reel_number
    end

    it "gets control image as PageIngest, by dmdid" do
      page = reel.page_by_dmdid('targetModsBib1')
      expect(page).to be_a NewspaperWorks::Ingest::NDNP::PageIngest
      expect(page.dmdid).to eq 'targetModsBib1'
    end

    it "shares xml document context with contained pages" do
      page = reel.page_by_dmdid('targetModsBib1')
      expect(page.doc).to be reel.doc
    end

    it "enumerates expected issues" do
      # enumerate by casting reel to Array
      issues = reel.to_a
      expect(issues.size).to eq 2
      expect(issues[0]).to be_a NewspaperWorks::Ingest::NDNP::IssueIngest
      expect(issues[0].path).to eq reel.issue_paths[0]
    end

    it "gets size, in issue count" do
      issues = reel.to_a
      expect(reel.size).to eq issues.size
      expect(reel.size).to eq reel.issue_paths.size
    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/ndnp/container_ingest_spec.rb
newspaper_works-1.0.0 spec/lib/newspaper_works/ingest/ndnp/container_ingest_spec.rb
newspaper_works-0.1.0 spec/lib/newspaper_works/ingest/ndnp/container_ingest_spec.rb