Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing require statements for tempfile #467

Merged
merged 1 commit into from Jul 6, 2020

Conversation

wconrad
Copy link

@wconrad wconrad commented May 13, 2020

When pdfkit is used in an rspec test run using the rspec binary, the
tests pass even with the missing require for tempfile, because rspec
is bringing in tempfile. But running pdfkit outside of a test
environment, in a project that is not already bringing in tempfile,
will fail.

The test for this is:

#!/usr/bin/env ruby

require "pdfkit"

PDFKit.new("")

Which results in a stack trace including:

/home/wayne/.rvm/gems/ruby-2.7.1/gems/pdfkit-0.8.4.2/lib/pdfkit/pdfkit.rb:94:in `find_options_in_meta': uninitialized constant PDFKit::Tempfile (NameError)

I don't know how to make a good test for this in rspec, since rspec hides the problem by bringing in the missing library. I guess the test could shell out to a little test file like the one above, but I don't know if that's worth the trouble.

When pdfkit is used in an rspec test run using the rspec binary, the
tests pass even with the missing require for tempfile, because rspec
is bringing in tempfile.  But running pdfkit outside of a test
environment, in a project that is not already bringing in tempfile,
will fail.
@serene serene added the ready label Jun 8, 2020
@serene serene merged commit 5678367 into pdfkit:master Jul 6, 2020
@serene serene removed the ready label Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants