Ask A Question

Notifications

You’re not receiving notifications from this thread.

Testing Rails ActionCable Channel

Kyle Jobbins asked in Rails

I followed along with the Online user tracking with ActionCable and was able to get it all working. I replicated a similar channel in another app and again it works great, however when I came to test the channel I hit a problem.

The problem:
Inside the the 'subscribed' method of the channel I am using the same 'ActionCable.serve.pubsub.redis_connection_for_subscriptions ...' as in the Online user tracking, this works fine in development, but when it comes to testing I get the following error;

NoMethodError: undefined methodredis_connection_for_subcsriptions' for #ActionCable::SubscriptionAdapter::Test:0x00007fbd5969d3e0`

I have dug around to try and figure out what is causing this and why but have not had any luck so far. Has anyone seen this error when working with/testing action cable channels, and how did you fix it ?

Thanks in advance

Reply

Did you figure out how to stub this? I've been trying to write some tests for this functionality as well and can not figure this out.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 87,563+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.