Skip to content

Commit

Permalink
Fix actioncable autoload problem
Browse files Browse the repository at this point in the history
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: hotwired/turbo-rails#512
  • Loading branch information
sascha-karnatz committed Nov 14, 2023
1 parent 0d8b119 commit 8fe1bb3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions spec/dummy/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 8fe1bb3

Please sign in to comment.