spec/pdfkit_spec.rb in pdfkit-0.5.2 vs spec/pdfkit_spec.rb in pdfkit-0.5.3
- old
+ new
@@ -65,10 +65,15 @@
pdfkit.command.should_not include('"--disable-smart-shrinking"')
end
it "should encapsulate string arguments in quotes" do
pdfkit = PDFKit.new('html', :header_center => "foo [page]")
- pdfkit.command[pdfkit.command.index('"--header-center"') + 1].should == '"foo [page]"'
+ pdfkit.command[pdfkit.command.index('"--header-center"') + 1].should == '"foo\ \[page\]"'
+ end
+
+ it "should sanitize string arguments" do
+ pdfkit = PDFKit.new('html', :header_center => "$(ls)")
+ pdfkit.command[pdfkit.command.index('"--header-center"') + 1].should == '"\$\(ls\)"'
end
it "read the source from stdin if it is html" do
pdfkit = PDFKit.new('html')
pdfkit.command[-2..-1].should == ['"-"', '"-"']