Sha256: e7f5b032edecbb207ee180aef4983a468446c3a18d85ef62000e53b6f834e794

Contents?: true

Size: 1.57 KB

Versions: 1

Compression:

Stored size: 1.57 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(:full_name, 'Wes Hays')

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

    page3 = GBDev::PDF::Page.new(template_file)
    page3.set_text(: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(:full_name, 'Wes Hays')

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

    page3 = GBDev::PDF::Page.new(template_file)
    page3.set_text(: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

1 entries across 1 versions & 1 rubygems

Version Path
gbdev-pdf_filler-0.2.0 spec/lib/pdf_book_spec.rb