Skip to content

Commit b430027

Browse files
javierjulioJonRowe
authored andcommitted
Wrap examples with Rails executor
This recreates #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 #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 #2503 and #2752 which the latter is meant as a temporary fix since this is the expected way to reset state.
1 parent ecac77b commit b430027

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/rspec/rails/example/rails_example_group.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
# suite and ammeter.
33
require 'rspec/rails/matchers'
44

5-
if ::Rails::VERSION::MAJOR >= 7
6-
require 'active_support/current_attributes/test_helper'
7-
require 'active_support/execution_context/test_helper'
8-
end
9-
105
module RSpec
116
module Rails
127
# @api public
@@ -17,10 +12,16 @@ module RailsExampleGroup
1712
include RSpec::Rails::MinitestLifecycleAdapter
1813
include RSpec::Rails::MinitestAssertionAdapter
1914
include RSpec::Rails::FixtureSupport
15+
include RSpec::Rails::TaggedLoggingAdapter if ::Rails::VERSION::MAJOR >= 7
16+
2017
if ::Rails::VERSION::MAJOR >= 7
2118
include RSpec::Rails::TaggedLoggingAdapter
22-
include ActiveSupport::CurrentAttributes::TestHelper
2319
include ActiveSupport::ExecutionContext::TestHelper
20+
included do |_other|
21+
around do |example|
22+
::Rails.application.executor.perform { example.call }
23+
end
24+
end
2425
end
2526
end
2627
end

0 commit comments

Comments
 (0)