Skip to content

Commit fa3806d

Browse files
authored
Wrap examples with Rails executor
This recreates rspec#2712 since the GHA logs are no longer available which we need to address this issue. We should be wrapping the Rails examples with the executor to mimic what Rails v7 does (as noted in rspec#2713) to properly reset state. This has been tested in a test suite for an app but we need to address what issues there is within rspec-rails. This change request originated from rspec#2503 and rspec#2752 which the latter is meant as a temporary fix since this is the expected way to reset state.
1 parent 967a54d commit fa3806d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/rspec/rails/example/rails_example_group.rb

+7-6
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
# suite and ammeter.
33
require 'rspec/rails/matchers'
44

5-
if ::Rails::VERSION::MAJOR >= 7
6-
require 'active_support/execution_context/test_helper'
7-
end
8-
95
module RSpec
106
module Rails
117
# @api public
@@ -16,9 +12,14 @@ module RailsExampleGroup
1612
include RSpec::Rails::MinitestLifecycleAdapter
1713
include RSpec::Rails::MinitestAssertionAdapter
1814
include RSpec::Rails::FixtureSupport
15+
include RSpec::Rails::TaggedLoggingAdapter if ::Rails::VERSION::MAJOR >= 7
16+
1917
if ::Rails::VERSION::MAJOR >= 7
20-
include RSpec::Rails::TaggedLoggingAdapter
21-
include ActiveSupport::ExecutionContext::TestHelper
18+
included do |_other|
19+
around do |example|
20+
::Rails.application.executor.perform { example.call }
21+
end
22+
end
2223
end
2324
end
2425
end

0 commit comments

Comments
 (0)