Sha256: b929c47397e21fd6f283b07b1eb974f93a3f72faeb387d3f357bc1e6652833a6

Contents?: true

Size: 1.07 KB

Versions: 12

Compression:

Stored size: 1.07 KB

Contents

# encoding: utf-8

require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")

describe "drawing span" do

  before do
    Prawn.debug = false
    create_pdf
  end

  after do
    Prawn.debug = true
  end

  it "should only accept :position as option in debug mode" do
    Prawn.debug = true
    lambda { @pdf.span(350, {:x => 3}) {} }.should raise_error(Prawn::Errors::UnknownOption)
  end

  it "should have raise an error if :position is invalid" do
    lambda { @pdf.span(350, :position => :x) {} }.should raise_error(ArgumentError)
  end

  it "should restore 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

    @pdf.bounds.should == margin_box
  end

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

    margin_box.top.should == 792.0
    margin_box.bottom.should == 0
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
prawn-git-2.0.1 spec/span_spec.rb
prawn-2.0.1 spec/span_spec.rb
prawn-2.0.0 spec/span_spec.rb
prawn-1.3.0 spec/span_spec.rb
prawn-1.2.1 spec/span_spec.rb
prawn-1.1.0 spec/span_spec.rb
prawn-1.0.0 spec/span_spec.rb
prawn-0.15.0 spec/span_spec.rb
prawn-0.14.0 spec/span_spec.rb
prawn-0.13.2 spec/span_spec.rb
prawn-0.13.1 spec/span_spec.rb
prawn-0.13.0 spec/span_spec.rb