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

Include ActiveSupport::Testing::Assertions in ActiveJob::TestHelpers #40780

Merged
merged 2 commits into from
Dec 18, 2020

Conversation

mikker
Copy link
Contributor

@mikker mikker commented Dec 10, 2020

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.

(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

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.
@rails-bot rails-bot bot added the activejob label Dec 10, 2020
@kaspth
Copy link
Contributor

kaspth commented Dec 10, 2020

@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.

@casperisfine
Copy link
Contributor

Not sure, also it was merged in minitest so I don't think it need special support in Rails anymore minitest/minitest#809

@casperisfine
Copy link
Contributor

Oh yes, re-reading the issue, that's definitely because of the block based assertions extra-safety I added.

@doits
Copy link
Contributor

doits commented Dec 10, 2020

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 rafaelfranca merged commit 96db850 into rails:master Dec 18, 2020
rafaelfranca added a commit that referenced this pull request Dec 18, 2020
Include ActiveSupport::Testing::Assertions in ActiveJob::TestHelpers
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants