Testing Rails ActionCable Channel
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 method
redis_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
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.