Rails 6.1 upgrade: undefined method `assert_nothing_raised'

Viewed 907

I'm running into this error when upgrading from Rails 6.0.3 to 6.1:

  NoMethodError:
    undefined method `assert_nothing_raised' for #<RSpec::ExampleGroups::EmailJob:0x00005572d8a00758>
    Did you mean?  assert_raises

This happens every time a test calls perform_enqueued_jobs. I'm using RSpec 3.9.

1 Answers

Apparently assert_nothing_raised is a helper method defined by ActiveSupport. I was able to solve this issue by explicitly including the helper in spec/rails_helper.rb:

RSpec.configure do |config|
  config.include(ActiveSupport::Testing::Assertions)
  # ...
Related