File: document_state_spec.rb

package info (click to toggle)
ruby-pdf-core 0.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 356 kB
  • sloc: ruby: 1,978; makefile: 4
file content (31 lines) | stat: -rw-r--r-- 834 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe PDF::Core::DocumentState do
  subject(:state) { described_class.new({}) }

  describe 'initialization' do
    it { expect(state.compress).to eq(false) }
    it { expect(state.encrypt).to eq(false) }
    it { expect(state.skip_encoding).to eq(false) }
    it { expect(state.trailer).to eq({}) }
  end

  describe 'normalize_metadata' do
    it { expect(state.store.info.data[:Creator]).to eq('Prawn') }
    it { expect(state.store.info.data[:Producer]).to eq('Prawn') }
  end

  describe 'given a trailer ID with two values' do
    subject(:state) do
      described_class.new(
        trailer: { ID: %w[myDoc versionA] }
      )
    end

    it 'contains the ID entry with two values in trailer' do
      expect(state.trailer[:ID].count).to eq(2)
    end
  end
end