Include ActiveSupport::Testing::Assertions in ActiveJob::TestHelpers#40780
Merged
rafaelfranca merged 2 commits intorails:masterfrom Dec 18, 2020
Merged
Include ActiveSupport::Testing::Assertions in ActiveJob::TestHelpers#40780rafaelfranca merged 2 commits intorails:masterfrom
rafaelfranca merged 2 commits intorails:masterfrom
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.
Contributor
|
@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. |
Contributor
|
Not sure, also it was merged in minitest so I don't think it need special support in Rails anymore minitest/minitest#809 |
Contributor
|
Oh yes, re-reading the issue, that's definitely because of the block based assertions extra-safety I added. |
Contributor
|
For reference this is the issue in rspec-rails about it: rspec/rspec-rails#2410 |
benoittgt
added a commit
to rspec/rspec-rails
that referenced
this pull request
Dec 10, 2020
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
rafaelfranca
added a commit
that referenced
this pull request
Dec 18, 2020
Include ActiveSupport::Testing::Assertions in ActiveJob::TestHelpers
3 tasks
This was referenced Jan 19, 2021
pirj
pushed a commit
to rspec/rspec-rails
that referenced
this pull request
Jan 20, 2021
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
pirj
pushed a commit
to rspec/rspec-rails
that referenced
this pull request
Feb 2, 2021
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
PChambino
added a commit
to PChambino/rails
that referenced
this pull request
Feb 2, 2021
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After upgrading to Rails 6.1 I'm getting a
undefined method 'assert_nothing_raised'usingActiveJob::TestHelpersandassert_enqueued_jobsin 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::Assertionsin your test/spec file)ruby 2.7.2p137
rails 6.1
rspec 3.9.3
rspec-rails 4.0.1