You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JRuby throws a NullPointerException in Rspec tests when creating tempfiles. The issue occurs when uploading fixture files using the same file across multiple describe blocks.
Here is the test code that exhibits the issue:
require'spec_helper'describe'Tempfile'dolet(:file){fixture_file_upload(Rails.root.join('spec/fixtures/file_1.txt').to_s)}describe'test'dodescribe'1'doit{expect{file}.to_notraise_exception}enddescribe'2'do# Test will pass if before block is uncommented# Or if config.order = "random" is commented in spec_helper# before { ActionMailer::Base.deliveries.clear }it{expect{file}.to_notraise_exception}endendend
As you can see, some versions of MRI and JRuby are passing and some aren't. In particular, JRuby v9.1.5.0 is where I first encountered this bug. While this test also doesn't pass in MRI, its in JRuby that I experience the NullPointerException which is why I'm reporting it here. (I think MRI is failing due to some other dependency issue or something...)
As noted in the README of the sample app, the bug appears when two conditions are true:
Rspec.config.order = "random"
ActionMailer::Base.deliveries is not cleared in a before block
Very weird, I know. I would bet those things are somehow triggering something else under the covers though.
Let me know if I can provide more information or if I should go about creating a better test case.
Thanks!
The text was updated successfully, but these errors were encountered:
do have a fix that resolves the NPE and everything seems fine. for whatever reason I'm failing to extract a reproducable isolated test-case. maybe it has to do with rspec's patching, will likely close this without a test.
JRuby throws a NullPointerException in Rspec tests when creating tempfiles. The issue occurs when uploading fixture files using the same file across multiple describe blocks.
Here is the test code that exhibits the issue:
I've created a sample app here https://github.com/synth/jruby-rspec-tempfile-bug
I've also got multiple builds being tested on TravisCI here: https://travis-ci.org/synth/jruby-rspec-tempfile-bug
As you can see, some versions of MRI and JRuby are passing and some aren't. In particular, JRuby v9.1.5.0 is where I first encountered this bug. While this test also doesn't pass in MRI, its in JRuby that I experience the NullPointerException which is why I'm reporting it here. (I think MRI is failing due to some other dependency issue or something...)
As noted in the README of the sample app, the bug appears when two conditions are true:
Very weird, I know. I would bet those things are somehow triggering something else under the covers though.
Let me know if I can provide more information or if I should go about creating a better test case.
Thanks!
The text was updated successfully, but these errors were encountered: