-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Undefined method "assert_nothing_raised" with Rails 6.1.0-rc2 #2410
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
Comments
Any reason not to use https://relishapp.com/rspec/rspec-expectations/v/3-9/docs/built-in-matchers/raise-error-matcher? expect { raise "oops" }.to raise_error |
I have the same problem, because using the RSpec.describe do
include ActiveJob::TestHelper
it 'works' do
perform_enqueued_jobs do
SomeService.doSomething
end
end
end
what's the best method to replicate that functionality? EDIT Workaround for now: RSpec.configure do |config|
def assert_nothing_raised(&block)
expect(&block).to_not raise_error
end
end |
It sounds like the module it is defined in has moved, there are a bunch of assertion modules we bring in to support various helpers. |
Method definition is located in ActiveSupport::Testing::Assertions. So you can also work around it by: RSpec.configure do |config|
config.include ActiveSupport::Testing::Assertions
end |
@benoittgt Do you think we can fix this for 6.1? |
This is fixed in Rails 6.1.1. rails/rails#40780, nothing to do here 🎉 |
@doits, thanks for the heads-up. It is known to be resolved in Rails (see #2398 (comment)). |
I think we should add the test from #2412 as a regression check, and if it passes with |
Regression test added in #2455 |
What Ruby, Rails and RSpec versions are you using?
Ruby version: 2.6.6
Rails version: 6.1.0-rc2
RSpec version: 4.1.0.pre (branch 6-1-dev)
Observed behaviour
Running rspec raises an error:
Expected behaviour
No "undefined method" error should be raised; it worked up until Rails 6.0.3.4.
Can you provide an example app?
Make a new app and add this to the Gemfile:
Install:
Add a test:
Run the tests:
The text was updated successfully, but these errors were encountered: