File tree Expand file tree Collapse file tree 3 files changed +17
-10
lines changed Expand file tree Collapse file tree 3 files changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -181,5 +181,15 @@ def assertion_delegator
181181 #
182182 # @private
183183 TestUnitAssertionAdapter = MinitestAssertionAdapter
184+
185+ # @private
186+ module TaggedLoggingAdapter
187+ require 'active_support/testing/tagged_logging'
188+ include ActiveSupport ::Testing ::TaggedLogging
189+
190+ # Just a stub as TaggedLogging is calling `name`
191+ def name
192+ end
193+ end
184194 end
185195end
Original file line number Diff line number Diff line change @@ -12,11 +12,7 @@ module RailsExampleGroup
1212 include RSpec ::Rails ::MinitestLifecycleAdapter
1313 include RSpec ::Rails ::MinitestAssertionAdapter
1414 include RSpec ::Rails ::FixtureSupport
15-
16- if ::Rails ::VERSION ::MAJOR >= 7
17- require 'active_support/testing/tagged_logging'
18- include ActiveSupport ::Testing ::TaggedLogging
19- end
15+ include RSpec ::Rails ::TaggedLoggingAdapter if ::Rails ::VERSION ::MAJOR >= 7
2016 end
2117 end
2218end
Original file line number Diff line number Diff line change 2929 end
3030
3131 gem "rspec-rails" , path : "../"
32+ gem 'pry-byebug'
3233end
3334
3435# Run specs at exit
4445# This connection will do for database-independent bug reports
4546ActiveRecord ::Base . establish_connection ( adapter : "sqlite3" , database : ":memory:" )
4647
48+ class TestError < StandardError ; end
49+
4750class TestJob < ActiveJob ::Base
48- def perform ; end
51+ def perform
52+ raise TestError
53+ end
4954end
5055
51- class TestError < StandardError ; end
52-
5356RSpec . describe 'Foo' , type : :job do
5457 include ::ActiveJob ::TestHelper
5558
5659 describe 'error raised in perform_enqueued_jobs with block' do
5760 it 'raises the explicitly thrown error' do
58- allow_any_instance_of ( TestJob ) . to receive ( :perform ) . and_raise ( TestError )
59-
6061 # Rails 6.1+ wraps unexpected errors in tests
6162 expected_error = if Rails ::VERSION ::STRING . to_f >= 6.1
6263 Minitest ::UnexpectedError . new ( TestError )
You can’t perform that action at this time.
0 commit comments