spec/middleware_spec.rb in pdfkit-0.8.5 vs spec/middleware_spec.rb in pdfkit-0.8.6
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require 'spec_helper'
def app; Rack::Lint.new(@app); end
def mock_app(options = {}, conditions = {}, custom_headers = {})
@@ -265,20 +267,20 @@
end
describe "saving generated pdf to disk" do
before do
#make sure tests don't find an old test_save.pdf
- File.delete('spec/test_save.pdf') if File.exists?('spec/test_save.pdf')
- expect(File.exists?('spec/test_save.pdf')).to eq(false)
+ File.delete('spec/test_save.pdf') if File.exist?('spec/test_save.pdf')
+ expect(File.exist?('spec/test_save.pdf')).to eq(false)
end
context "when header PDFKit-save-pdf is present" do
it "saves the .pdf to disk" do
headers = { 'PDFKit-save-pdf' => 'spec/test_save.pdf' }
mock_app({}, {only: '/public'}, headers)
get 'http://www.example.org/public/test_save.pdf'
- expect(File.exists?('spec/test_save.pdf')).to eq(true)
+ expect(File.exist?('spec/test_save.pdf')).to eq(true)
end
it "does not raise when target directory does not exist" do
headers = { 'PDFKit-save-pdf' => '/this/dir/does/not/exist/spec/test_save.pdf' }
mock_app({}, {only: '/public'}, headers)
@@ -290,10 +292,10 @@
context "when header PDFKit-save-pdf is not present" do
it "does not saved the .pdf to disk" do
mock_app({}, {only: '/public'}, {} )
get 'http://www.example.org/public/test_save.pdf'
- expect(File.exists?('spec/test_save.pdf')).to eq(false)
+ expect(File.exist?('spec/test_save.pdf')).to eq(false)
end
end
end
describe 'javascript delay' do