Sha256: a2bc28d56ab22ceb75e3145cf2ace14febe6e09202a9d402e960c5ded46f8bc1

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

# encoding: utf-8

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

describe "A Reference object" do
  it "should produce a PDF reference on #to_s call" do
    ref = Prawn::Reference(1,true)
    ref.to_s.should == "1 0 R"
  end                                        
  
  it "should allow changing generation number" do
    ref = Prawn::Reference(1,true)
    ref.gen = 1
    ref.to_s.should == "1 1 R"
  end
  
  it "should generate a valid PDF object for the referenced data" do
    ref = Prawn::Reference(2,[1,"foo"]) 
    ref.object.should == "2 0 obj\n#{Prawn::PdfObject([1,"foo"])}\nendobj\n" 
  end             
  
  it "should automatically open a stream when #<< is used" do
     ref = Prawn::Reference(1, :Length => 41)
     ref << "BT\n/F1 12 Tf\n72 712 Td\n( A stream ) Tj\nET"   
     ref.object.should == "1 0 obj\n<< /Length 41\n>>\nstream"+
                           "\nBT\n/F1 12 Tf\n72 712 Td\n( A stream ) Tj\nET" +
                           "\nendstream\nendobj\n"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
prawn-0.1.0 spec/reference_spec.rb
prawn-0.1.1 spec/reference_spec.rb