spec/pdfkit_spec.rb in pdfkit-0.8.5 vs spec/pdfkit_spec.rb in pdfkit-0.8.6
- old
+ new
@@ -1,6 +1,8 @@
#encoding: UTF-8
+# frozen_string_literal: true
+
require 'spec_helper'
describe PDFKit do
describe "initialization" do
# Source
@@ -25,11 +27,11 @@
it "accepts a Tempfile as the source" do
file_path = File.join(SPEC_ROOT,'fixtures','example.html')
pdfkit = PDFKit.new(Tempfile.new(file_path))
expect(pdfkit.source).to be_file
- expect(pdfkit.source.to_s).to match /^#{Dir.tmpdir}/
+ expect(pdfkit.source.to_s).to match(/^#{Dir.tmpdir}/)
end
# Options
## options keys
it "drops options without values" do
@@ -237,16 +239,16 @@
expect(pdfkit.command).to include "--header-center \\$\\(ls\\)"
end
it "read the source from stdin if it is html" do
pdfkit = PDFKit.new('html')
- expect(pdfkit.command).to match /- -$/
+ expect(pdfkit.command).to match(/- -$/)
end
it "specifies the URL to the source if it is a url" do
pdfkit = PDFKit.new('http://google.com')
- expect(pdfkit.command).to match /"http:\/\/google.com" -$/
+ expect(pdfkit.command).to match(/"http:\/\/google.com" -$/)
end
it "does not break Windows paths" do
pdfkit = PDFKit.new('html')
allow(PDFKit.configuration).to receive(:wkhtmltopdf).and_return 'c:/Program Files/wkhtmltopdf/wkhtmltopdf.exe'
@@ -254,22 +256,22 @@
end
it "specifies the path to the source if it is a file" do
file_path = File.join(SPEC_ROOT,'fixtures','example.html')
pdfkit = PDFKit.new(File.new(file_path))
- expect(pdfkit.command).to match /#{file_path} -$/
+ expect(pdfkit.command).to match(/#{file_path} -$/)
end
it "specifies the path to the source if it is a tempfile" do
file_path = File.join(SPEC_ROOT,'fixtures','example.html')
pdfkit = PDFKit.new(Tempfile.new(file_path))
- expect(pdfkit.command).to match /#{Dir.tmpdir}\S+ -$/
+ expect(pdfkit.command).to match(/#{Dir.tmpdir}\S+ -$/)
end
it "specifies the path for the ouput if a path is given" do
file_path = "/path/to/output.pdf"
pdfkit = PDFKit.new("html")
- expect(pdfkit.command(file_path)).to match /#{file_path}$/
+ expect(pdfkit.command(file_path)).to match(/#{file_path}$/)
end
it "detects special pdfkit meta tags" do
body = %{
<html>