Sha256: 64bde57ce6c3a06832c5aaef5aa514b3a00c8b1a637a91083b26bb05ea5b2657

Contents?: true

Size: 909 Bytes

Versions: 3

Compression:

Stored size: 909 Bytes

Contents

require 'spec_helper'

describe Prawn::Document do
  let(:pdf) { create_pdf }

  it 'onlies accept :position as option in debug mode' do
    Prawn.debug = true
    expect { pdf.span(350, x: 3) {} }
      .to raise_error(Prawn::Errors::UnknownOption)
  end

  it 'has raise an error if :position is invalid' do
    expect { pdf.span(350, position: :x) {} }.to raise_error(ArgumentError)
  end

  it 'restores the margin box when bounding box exits' do
    margin_box = pdf.bounds

    pdf.span(350, position: :center) do
      pdf.text "Here's some centered text in a 350 point column. " * 100
    end

    expect(pdf.bounds).to eq(margin_box)
  end

  it 'does create a margin box' do
    margin_box = pdf.span(350, position: :center) do
      pdf.text "Here's some centered text in a 350 point column. " * 100
    end

    expect(margin_box.top).to eq(792.0)
    expect(margin_box.bottom).to eq(0)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
prawn-2.2.2 spec/prawn/document_span_spec.rb
prawn-2.2.1 spec/prawn/document_span_spec.rb
prawn-2.2.0 spec/prawn/document_span_spec.rb