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 Apr 6, 2024
1 parent 967a54d commit fa3806d
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,10 +2,6 @@
# suite and ammeter.
require 'rspec/rails/matchers'

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

module RSpec
module Rails
# @api public
Expand All @@ -16,9 +12,14 @@ 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::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 fa3806d

Please # to comment.