spec/pdfkit_spec.rb in pdfkit-0.5.1 vs spec/pdfkit_spec.rb in pdfkit-0.5.2
- old
+ new
@@ -176,9 +176,18 @@
pdfkit = PDFKit.new('http://google.com')
css = File.join(SPEC_ROOT,'fixtures','example.css')
pdfkit.stylesheets << css
lambda { pdfkit.to_pdf }.should raise_error(PDFKit::ImproperSourceError)
end
+
+ it "should be able to deal with ActiveSupport::SafeBuffer" do
+ pdfkit = PDFKit.new(ActiveSupport::SafeBuffer.new "<html><head></head><body>Hai!</body></html>")
+ css = File.join(SPEC_ROOT,'fixtures','example.css')
+ pdfkit.stylesheets << css
+ pdfkit.to_pdf
+ pdfkit.source.to_s.should include("<style>#{File.read(css)}</style></head>")
+ end
+
end
context "#to_file" do
before do
@file_path = File.join(SPEC_ROOT,'fixtures','test.pdf')