|
1 | 1 | #encoding: UTF-8
|
| 2 | +# frozen_string_literal: true |
| 3 | + |
2 | 4 | require 'spec_helper'
|
3 | 5 |
|
4 | 6 | describe PDFKit do
|
|
27 | 29 | file_path = File.join(SPEC_ROOT,'fixtures','example.html')
|
28 | 30 | pdfkit = PDFKit.new(Tempfile.new(file_path))
|
29 | 31 | expect(pdfkit.source).to be_file
|
30 |
| - expect(pdfkit.source.to_s).to match /^#{Dir.tmpdir}/ |
| 32 | + expect(pdfkit.source.to_s).to match(/^#{Dir.tmpdir}/) |
31 | 33 | end
|
32 | 34 |
|
33 | 35 | # Options
|
|
239 | 241 |
|
240 | 242 | it "read the source from stdin if it is html" do
|
241 | 243 | pdfkit = PDFKit.new('html')
|
242 |
| - expect(pdfkit.command).to match /- -$/ |
| 244 | + expect(pdfkit.command).to match(/- -$/) |
243 | 245 | end
|
244 | 246 |
|
245 | 247 | it "specifies the URL to the source if it is a url" do
|
246 | 248 | pdfkit = PDFKit.new('http://google.com')
|
247 |
| - expect(pdfkit.command).to match /"http:\/\/google.com" -$/ |
| 249 | + expect(pdfkit.command).to match(/"http:\/\/google.com" -$/) |
248 | 250 | end
|
249 | 251 |
|
250 | 252 | it "does not break Windows paths" do
|
|
256 | 258 | it "specifies the path to the source if it is a file" do
|
257 | 259 | file_path = File.join(SPEC_ROOT,'fixtures','example.html')
|
258 | 260 | pdfkit = PDFKit.new(File.new(file_path))
|
259 |
| - expect(pdfkit.command).to match /#{file_path} -$/ |
| 261 | + expect(pdfkit.command).to match(/#{file_path} -$/) |
260 | 262 | end
|
261 | 263 |
|
262 | 264 | it "specifies the path to the source if it is a tempfile" do
|
263 | 265 | file_path = File.join(SPEC_ROOT,'fixtures','example.html')
|
264 | 266 | pdfkit = PDFKit.new(Tempfile.new(file_path))
|
265 |
| - expect(pdfkit.command).to match /#{Dir.tmpdir}\S+ -$/ |
| 267 | + expect(pdfkit.command).to match(/#{Dir.tmpdir}\S+ -$/) |
266 | 268 | end
|
267 | 269 |
|
268 | 270 | it "specifies the path for the ouput if a path is given" do
|
269 | 271 | file_path = "/path/to/output.pdf"
|
270 | 272 | pdfkit = PDFKit.new("html")
|
271 |
| - expect(pdfkit.command(file_path)).to match /#{file_path}$/ |
| 273 | + expect(pdfkit.command(file_path)).to match(/#{file_path}$/) |
272 | 274 | end
|
273 | 275 |
|
274 | 276 | it "detects special pdfkit meta tags" do
|
|
0 commit comments