diff --git a/lib/rspec/rails/example/rails_example_group.rb b/lib/rspec/rails/example/rails_example_group.rb index c3d42a527..208f7c386 100644 --- a/lib/rspec/rails/example/rails_example_group.rb +++ b/lib/rspec/rails/example/rails_example_group.rb @@ -13,6 +13,23 @@ module RailsExampleGroup include RSpec::Rails::MinitestAssertionAdapter include RSpec::Rails::FixtureSupport include RSpec::Rails::TaggedLoggingAdapter if ::Rails::VERSION::MAJOR >= 7 + + included do |_other| + around do |example| + use_exectuor = + case ::Rails.configuration.active_support.executor_around_test_case + when nil then ::Rails::VERSION::MAJOR >= 7 + when true then true + when false then false + end + + if use_exectuor + ::Rails.application.executor.perform { example.call } + else + example.call + end + end + end end end end