Skip to content

Commit 0e72a05

Browse files
authored
Reset CurrentAttributes on each rails example
This needs to be included otherwise RSpec does not reset ActiveSupport::CurrentAttributes around each example. We need to mimic what Rails does in: https://github.com/rails/rails/blob/v7.0.0/activesupport/lib/active_support/railtie.rb#L50-L61 for the "else" case until rspec#2712 can be revisited.
1 parent 967a54d commit 0e72a05

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/rspec/rails/example/rails_example_group.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
require 'rspec/rails/matchers'
44

55
if ::Rails::VERSION::MAJOR >= 7
6+
require "active_support/current_attributes/test_helper"
67
require 'active_support/execution_context/test_helper'
78
end
89

@@ -18,6 +19,7 @@ module RailsExampleGroup
1819
include RSpec::Rails::FixtureSupport
1920
if ::Rails::VERSION::MAJOR >= 7
2021
include RSpec::Rails::TaggedLoggingAdapter
22+
include ActiveSupport::CurrentAttributes::TestHelper
2123
include ActiveSupport::ExecutionContext::TestHelper
2224
end
2325
end

0 commit comments

Comments
 (0)