Sha256: 5b779179c1aae57d7c114d47cf3b606de06135d092a6ba4bacf2707798d0188f

Contents?: true

Size: 1.83 KB

Versions: 3

Compression:

Stored size: 1.83 KB

Contents

require 'spec_helper'
require 'ndnp_shared'

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

  describe "sample batch" do
    let(:batch) { described_class.new(batch1) }

    it "gets batch name" do
      expect(batch.name).to eq 'batch_test'
    end

    it "gets issue by path" do
      path = batch.issue_paths[0]
      issue = batch.get(path)
      expect(issue).to be_a NewspaperWorks::Ingest::NDNP::IssueIngest
      expect(issue.path).to eq path
    end

    it "gets reel/container by path" do
      path = batch.container_paths[0]
      container = batch.get(path)
      expect(container).to be_a NewspaperWorks::Ingest::NDNP::ContainerIngest
      expect(container.path).to eq path
    end

    it "enumerates container paths" do
      reel_ids = batch.container_paths
      expect(reel_ids).to be_an Array
      expect(reel_ids.size).to eq 3
    end

    it "enumerates issue paths" do
      issue_ids = batch.issue_paths
      expect(issue_ids).to be_an Array
      expect(issue_ids.size).to eq 4
    end

    it "enumerates issues via method" do
      issues = batch.issues
      expect(issues).to be_an Array
      expect(issues.size).to eq 4
      expect(issues[0]).to be_a NewspaperWorks::Ingest::NDNP::IssueIngest
    end

    it "makes batch fixed-size enumerable of issues" do
      expect(batch.size).to eq batch.issue_paths.size
      issues = batch.to_a # implied .each
      expect(issues.size).to eq batch.size
      expect(issues.size).to eq 4
      issues.each do |issue|
        expect(issue).to be_a NewspaperWorks::Ingest::NDNP::IssueIngest
      end
    end

    it "enumerates containers" do
      reels = batch.containers
      expect(reels).to be_an Array
      expect(reels.size).to eq 3
      expect(reels[0]).to be_a NewspaperWorks::Ingest::NDNP::ContainerIngest
    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/batch_xml_ingest_spec.rb
newspaper_works-1.0.0 spec/lib/newspaper_works/ingest/ndnp/batch_xml_ingest_spec.rb
newspaper_works-0.1.0 spec/lib/newspaper_works/ingest/ndnp/batch_xml_ingest_spec.rb