Sha256: 52a6cd90852b02ab70d6e10136aa067fa7672653b00df8f07d2b9630468fe602

Contents?: true

Size: 998 Bytes

Versions: 3

Compression:

Stored size: 998 Bytes

Contents

require 'spec_helper'

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

  let(:lccn) { 'sn93059126' }

  let(:pdf_path) { File.join(pdf_fixtures, lccn, '1853060401.pdf') }

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

  describe "issue construction and metadata" do
    it "constructs with path and publication" do
      issue = described_class.new(pdf_path, publication)
      expect(issue.path).to eq pdf_path
      expect(issue.filename).to eq File.basename(pdf_path)
      expect(issue.publication).to be publication
      expect(issue.lccn).to eq lccn
      expect(issue.publication.lccn).to eq lccn
    end

    it "extracts date, edition, title from filename" do
      issue = described_class.new(pdf_path, publication)
      expect(issue.publication_date).to eq '1853-06-04'
      expect(issue.edition_number).to eq 1
      expect(issue.title).to contain_exactly 'The weekly journal: June 4, 1853'
    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/pdf_issue_spec.rb
newspaper_works-1.0.0 spec/lib/newspaper_works/ingest/pdf_issue_spec.rb
newspaper_works-0.1.0 spec/lib/newspaper_works/ingest/pdf_issue_spec.rb