Sha256: e9ba7e5d9d1e5f75ab4f07d754fa427120bef1a034337da0c42978f43f47f1ee

Contents?: true

Size: 1.6 KB

Versions: 3

Compression:

Stored size: 1.6 KB

Contents

require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")

describe 'Book' do
  
  it 'should create the book of pages and write to the output directory' do
    book = GBDev::PDF::Book.new
    
    template_file = File.expand_path(File.dirname(__FILE__) + '/../templates/certificate_template.pdf')
    pdf_book = File.expand_path(File.dirname(__FILE__) + '/../output/certs.pdf')

    page1 = GBDev::PDF::Page.new(template_file)
    page1.set_text_field(:full_name, 'Wes Hays')

    page2 = GBDev::PDF::Page.new(template_file)
    page2.set_text_field(:full_name, 'Darren Johnson')

    page3 = GBDev::PDF::Page.new(template_file)
    page3.set_text_field(:full_name, 'John Dell')
    
    book.add_page(page1)
    book.add_page(page2)
    book.add_page(page3)
    
    book.save_to(pdf_book)
    
    File.exist?(pdf_book).should be_true
  end  
  
  it 'should create the book of pages and write to the output directory with Kernel method' do
    book = PDFBook()
    
    template_file = File.expand_path(File.dirname(__FILE__) + '/../templates/certificate_template.pdf')
    pdf_book = File.expand_path(File.dirname(__FILE__) + '/../output/certs.pdf')

    page1 = GBDev::PDF::Page.new(template_file)
    page1.set_text_field(:full_name, 'Wes Hays')

    page2 = GBDev::PDF::Page.new(template_file)
    page2.set_text_field(:full_name, 'Darren Johnson')

    page3 = GBDev::PDF::Page.new(template_file)
    page3.set_text_field(:full_name, 'John Dell')
    
    book.add_page(page1)
    book.add_page(page2)
    book.add_page(page3)
    
    book.save_to(pdf_book)
    
    File.exist?(pdf_book).should be_true
  end  
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gbdev-pdf_filler-0.3.0 spec/lib/pdf_book_spec.rb
gbdev-pdf_filler-0.3.1 spec/lib/pdf_book_spec.rb
gbdev-pdf_filler-0.3.2 spec/lib/pdf_book_spec.rb