File: document_reference_spec.rb

package info (click to toggle)
ruby-prawn 2.2.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 4,320 kB
  • sloc: ruby: 15,654; sh: 43; makefile: 20
file content (25 lines) | stat: -rw-r--r-- 708 bytes parent folder | download
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
require 'spec_helper'

describe Prawn::Document do
  describe 'A Reference object' do
    describe 'generated via Prawn::Document' do
      it 'returns a proper reference on ref!' do
        pdf = described_class.new
        expect(pdf.ref!({}).is_a?(PDF::Core::Reference)).to eq(true)
      end

      it 'returns an identifier on ref' do
        pdf = described_class.new
        r = pdf.ref({})
        expect(r.is_a?(Integer)).to eq(true)
      end

      it 'has :Length of stream if it has one when compression disabled' do
        pdf = described_class.new compress: false
        ref = pdf.ref!({})
        ref << 'Hello'
        expect(ref.stream.data[:Length]).to eq(5)
      end
    end
  end
end