Sha256: f89ab724099dedc0210751d2d746bcfc2ea074b21297d1169c4494d2b3a14150

Contents?: true

Size: 921 Bytes

Versions: 3

Compression:

Stored size: 921 Bytes

Contents

require 'spec_helper'

RSpec.describe NewspaperWorks::Ingest::PageImage do
  include_context 'ingest test fixtures'

  let(:lccn) { 'sn93059126' }

  let(:issue_path) { File.join(tiff_fixtures, lccn, '1853060401') }

  let(:publication) { NewspaperWorks::Ingest::PublicationInfo.new(lccn) }

  let(:issue) do
    NewspaperWorks::Ingest::IssueImages.new(issue_path, publication)
  end

  describe "page construction and metadata" do
    it "validates path to page image file" do
      garbage_path = '/path/to/nonexistent'
      expect { described_class.new(garbage_path, issue, 1) }.to raise_error ArgumentError
    end

    it "extracts page number, title from image filename" do
      path = issue.keys[0]
      page = described_class.new(path, issue, 1)
      expect(page.page_number).to eq "1"
      expect(page.title).to contain_exactly "The weekly journal: June 4, 1853: Page #{page.page_number}"
    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/page_image_spec.rb
newspaper_works-1.0.0 spec/lib/newspaper_works/ingest/page_image_spec.rb
newspaper_works-0.1.0 spec/lib/newspaper_works/ingest/page_image_spec.rb