Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap tests in executor when configured or on Rails 7 by default #2712

Closed
wants to merge 1 commit into from

Conversation

JonRowe
Copy link
Member

@JonRowe JonRowe commented Nov 16, 2023

No description provided.

when nil then ::Rails::VERSION::MAJOR >= 7
when true then true
when false then false
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to do this. "Default in Rails 7" means it is set as true when calling config.load_defaults 7.0. Otherwise, it should stay disabled.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean it’s unnecessary to default to true on Rails 7, and it’s sufficient to just?

use_exectuor = ::Rails.configuration.active_support.executor_around_test_case

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pirj pirj deleted the wrap-tests-in-exector branch December 13, 2023 13:30
javierjulio added a commit to javierjulio/rspec-rails that referenced this pull request Apr 6, 2024
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.
javierjulio added a commit to javierjulio/rspec-rails that referenced this pull request Apr 6, 2024
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.
JonRowe pushed a commit to javierjulio/rspec-rails that referenced this pull request Apr 10, 2024
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants