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

rails tests fail after turbo-rails upgrade from 1.5.0 to 2.0.3 #587

Open
xeron opened this issue Feb 17, 2024 · 5 comments
Open

rails tests fail after turbo-rails upgrade from 1.5.0 to 2.0.3 #587

xeron opened this issue Feb 17, 2024 · 5 comments

Comments

@xeron
Copy link

xeron commented Feb 17, 2024

NoMethodError: undefined method `fetch' for nil:NilClass
    vendor/bundle/ruby/3.1.0/gems/actioncable-7.1.3/lib/action_cable/server/configuration.rb:38:in `pubsub_adapter'
    vendor/bundle/ruby/3.1.0/gems/actioncable-7.1.3/lib/action_cable/server/base.rb:86:in `block in pubsub'
    vendor/bundle/ruby/3.1.0/gems/actioncable-7.1.3/lib/action_cable/server/base.rb:86:in `synchronize'
    vendor/bundle/ruby/3.1.0/gems/actioncable-7.1.3/lib/action_cable/server/base.rb:86:in `pubsub'
    vendor/bundle/ruby/3.1.0/gems/actioncable-7.1.3/lib/action_cable/test_helper.rb:10:in `before_setup'
    vendor/bundle/ruby/3.1.0/gems/activerecord-7.1.3/lib/active_record/test_fixtures.rb:11:in `before_setup'
    vendor/bundle/ruby/3.1.0/gems/activesupport-7.1.3/lib/active_support/testing/setup_and_teardown.rb:40:in `before_setup'
@morgoth
Copy link
Contributor

morgoth commented Feb 19, 2024

Most likely there is no config/cable.yml file in your app.

@xeron
Copy link
Author

xeron commented Feb 19, 2024

Most likely there is no config/cable.yml file in your app.

You're right. Creating this file fixes the issue. I don't use actioncable tho and the app itself works just fine without it.

@t27duck
Copy link
Contributor

t27duck commented Feb 19, 2024

If you have require "rails/all" in your application.rb file or have the action cable railtie required, then action cable is loaded up. The test helpers that were added in ef4a624 fires up code... somewhere that makes action cable want to set up a server in tests which looks for config/cable.yml. Missing the file results in that exception.

@Manfred
Copy link

Manfred commented Feb 23, 2024

If Action Cable is now required to use Turbo in Rails, it could be good to add it to turbo-rails.gemspec.

@AxelTheGerman
Copy link

Also noticed this after upgrading. I don't have require "action_cable/engine" in my app nor require "rails/all". My tests pass but when preloading the application it fails with:

.../vendor/bundle/ruby/3.2.0/gems/turbo-rails-2.0.5/app/channels/turbo/streams_channel.rb:34:in `<top (required)>': uninitialized constant ActionCable (NameError)
class Turbo::StreamsChannel < ActionCable::Channel::Base

Why would action cable be required or should the gem check if ActionCable is defined and only then load the relevant files?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants