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

[TAN-3184] Eliminate new_framework_defaults_7_0.rb #9854

Merged
3 changes: 1 addition & 2 deletions back/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ module Cl2Back
class Application < Rails::Application
require_dependency Rails.root.join('lib/citizen_lab')

# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.1
config.load_defaults 7.0

# Configuration for the application, engines, and railties goes here.
#
Expand Down
130 changes: 0 additions & 130 deletions back/config/initializers/new_framework_defaults_7_0.rb

This file was deleted.

16 changes: 0 additions & 16 deletions back/config/initializers/wrap_parameters.rb

This file was deleted.

25 changes: 13 additions & 12 deletions back/spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,19 @@
config.include StubEnvHelper
config.include XlsxHelper

# If we do not include the following module, the controller tests do not reset the
# `CurrentAttributes` before and after each test.
# Per: https://bytemeta.vip/repo/rspec/rspec-rails/issues/2503, rspec-rails should in
# theory load the helpers automatically, but for some reason this does not seem to
# work.
# > If you add type: :model the problem should similarly go away, we don't include
# > rails helpers except when running a rails test, so currently you'd need to pick
# > one of the rails types.
#
# As a quick fix, we import the module explicitly. A tech-debt ticket has been logged
# here: https://citizenlab.atlassian.net/browse/CL-1860
config.include ActiveSupport::CurrentAttributes::TestHelper, type: :controller
# rspec-rails do not take the `executor_around_test_case` option into account. There is
# an open issue for this: https://github.com/rspec/rspec-rails/pull/2753.
# Here, we replicate the behavior used by Rails for `ActiveSupport::TestCase`.
# See: https://github.com/rails/rails/blob/8278626a2c0e0ee4dc762891a91e70708380b4d6/activesupport/lib/active_support/railtie.rb#L52-L63
if Rails.application.config.active_support.executor_around_test_case
config.include ExecutorTestHelper
else
require 'active_support/current_attributes/test_helper'
config.include ActiveSupport::CurrentAttributes::TestHelper

require 'active_support/execution_context/test_helper'
config.include ActiveSupport::ExecutionContext::TestHelper
end
end

ActiveJob::Base.queue_adapter = :test
9 changes: 9 additions & 0 deletions back/spec/support/executor_test_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

module ExecutorTestHelper
def self.included(base)
base.around do |example|
Rails.application.executor.perform { example.run }
end
end
end