-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Include ActiveSupport::Testing::Assertions in ActiveJob::TestHelpers #40780
Include ActiveSupport::Testing::Assertions in ActiveJob::TestHelpers #40780
Conversation
After upgrading to Rails 6.1 I'm getting a `undefined method `assert_nothing_raised'` using `ActiveJob::TestHelpers` and `assert_enqueued_jobs` in RSpec. Adding this module fixes it, however not knowing the internals too well, I'm unsure whether it's the right fix.
@mikker ah, thanks! Is it possible to try a bisect to find the commit that did this? @casperisfine was this related to any of the minitest fixes you worked on, and the block assertion order? iirc there was something with assert_nothing_raised there. |
Not sure, also it was merged in minitest so I don't think it need special support in Rails anymore minitest/minitest#809 |
Oh yes, re-reading the issue, that's definitely because of the block based assertions extra-safety I added. |
For reference this is the issue in rspec-rails about it: rspec/rspec-rails#2410 |
This method has been moved in rails/rails@3cece0b We do not include ActiveSupport::Testing::Assertion at the moment. To avoid having to deal with complicated scenarios like Minitest errors. We redefine our own methods in rspec-rails. Related: rails/rails#40780
Include ActiveSupport::Testing::Assertions in ActiveJob::TestHelpers
This method has been moved in rails/rails@3cece0b We do not include ActiveSupport::Testing::Assertion. Method was added back in rails/rails#40780, and was released in Rails 6.1.1
This method has been moved in rails/rails@3cece0b We do not include ActiveSupport::Testing::Assertion. This resulted in failures when `perform_enqueued_jobs do` was called from specs. Method was added back in rails/rails#40780, and was released in Rails 6.1.1
Following PR rails#40780, it now fails after requiring active_job: irb(main):001:0> require 'active_job' => true irb(main):002:0> ActiveJob::VERSION::STRING => "6.1.1" irb(main):003:0> ActiveJob::TestHelper [redacted] NameError (uninitialized constant ActiveSupport::Testing)
After upgrading to Rails 6.1 I'm getting a
undefined method 'assert_nothing_raised'
usingActiveJob::TestHelpers
andassert_enqueued_jobs
in RSpec.Adding this module fixes it, however not knowing the internals too well, I'm unsure whether it's the right fix.
(To fix this in your own app,
include ActiveSupport::Testing::Assertions
in your test/spec file)ruby 2.7.2p137
rails 6.1
rspec 3.9.3
rspec-rails 4.0.1