From 8fe1bb3326378c1a0d571eea69496b68dab4fec7 Mon Sep 17 00:00:00 2001 From: Sascha Karnatz <122262394+sascha-karnatz@users.noreply.github.com> Date: Tue, 14 Nov 2023 10:55:51 +0100 Subject: [PATCH] Fix actioncable autoload problem The CI test pipeline breaks for Rails 7.1. The eager loading results into a Zeitwerk error in the turbo-rails gem. The current solution is to include actioncable if the application is running in a Github Action until this bug is fixed. Ref: https://github.com/hotwired/turbo-rails/issues/512 --- Gemfile | 5 +++++ spec/dummy/config/environments/test.rb | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/Gemfile b/Gemfile index f5ff6d81d5..5434887ba3 100644 --- a/Gemfile +++ b/Gemfile @@ -26,6 +26,11 @@ group :development, :test do # Necessary because GH Actions gem cache does not have this "Bundled with Ruby" gem installed gem "rexml", "~> 3.2.4" gem "sassc", "~> 2.4.0" # https://github.com/sass/sassc-ruby/issues/146 + + # https://github.com/hotwired/turbo-rails/issues/512 + if rails_version == "7.1" + gem "actioncable", "~> #{rails_version}.0" + end else gem "launchy" gem "annotate" diff --git a/spec/dummy/config/environments/test.rb b/spec/dummy/config/environments/test.rb index eb23db32e9..88b3798a74 100644 --- a/spec/dummy/config/environments/test.rb +++ b/spec/dummy/config/environments/test.rb @@ -16,6 +16,11 @@ # system, or in some way before deploying your code. config.eager_load = ENV["CI"].present? + # Issue: https://github.com/hotwired/turbo-rails/issues/512 + if ENV["CI"].present? + Rails.autoloaders.once.do_not_eager_load("#{Turbo::Engine.root}/app/channels") + end + # Configure public file server for tests with Cache-Control for performance. config.public_file_server.enabled = true config.public_file_server.headers = {