Skip to content

Commit

Permalink
Wrap examples with Rails executor
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
javierjulio authored and JonRowe committed Apr 10, 2024
1 parent ecac77b commit b430027
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/rspec/rails/example/rails_example_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
# suite and ammeter.
require 'rspec/rails/matchers'

if ::Rails::VERSION::MAJOR >= 7
require 'active_support/current_attributes/test_helper'
require 'active_support/execution_context/test_helper'
end

module RSpec
module Rails
# @api public
Expand All @@ -17,10 +12,16 @@ module RailsExampleGroup
include RSpec::Rails::MinitestLifecycleAdapter
include RSpec::Rails::MinitestAssertionAdapter
include RSpec::Rails::FixtureSupport
include RSpec::Rails::TaggedLoggingAdapter if ::Rails::VERSION::MAJOR >= 7

if ::Rails::VERSION::MAJOR >= 7
include RSpec::Rails::TaggedLoggingAdapter
include ActiveSupport::CurrentAttributes::TestHelper
include ActiveSupport::ExecutionContext::TestHelper
included do |_other|
around do |example|
::Rails.application.executor.perform { example.call }
end
end
end
end
end
Expand Down

0 comments on commit b430027

Please sign in to comment.