Skip to content

Commit

Permalink
#exec didnt like anything but strings as parameters, fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
David Burry committed Jul 19, 2010
1 parent f82e6b3 commit 37864e0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/pdfkit/pdfkit.rb
Expand Up @@ -105,7 +105,7 @@ def normalize_value(value)
when TrueClass
nil
else
value
value.to_s
end
end

Expand Down
14 changes: 13 additions & 1 deletion spec/pdfkit_spec.rb
Expand Up @@ -45,7 +45,7 @@
pdfkit = PDFKit.new('html', :page_size => 'Letter', :toc_l1_font_size => 12)
pdfkit.command[0].should include('wkhtmltopdf')
pdfkit.command[pdfkit.command.index('--page-size') + 1].should == 'Letter'
pdfkit.command[pdfkit.command.index('--toc-l1-font-size') + 1].should == 12
pdfkit.command[pdfkit.command.index('--toc-l1-font-size') + 1].should == '12'
end

it "will not include default options it is told to omit" do
Expand Down Expand Up @@ -84,6 +84,18 @@
pdf[0...4].should == "%PDF" # PDF Signature at beginning of file
end

it "should generate a PDF with a numerical parameter" do
pdfkit = PDFKit.new('html', :header_spacing => 1)
pdf = pdfkit.to_pdf
pdf[0...4].should == "%PDF" # PDF Signature at beginning of file
end

it "should generate a PDF with a symbol parameter" do
pdfkit = PDFKit.new('html', :page_size => :Letter)
pdf = pdfkit.to_pdf
pdf[0...4].should == "%PDF" # PDF Signature at beginning of file
end

it "should have the stylesheet added to the head if it has one" do
pdfkit = PDFKit.new("<html><head></head><body>Hai!</body></html>")
css = File.join(SPEC_ROOT,'fixtures','example.css')
Expand Down

0 comments on commit 37864e0

Please sign in to comment.