I have recently started working with ActionCable and have managed to get multiple channels working, however when coming to test the channels I have hit a problem.
Example Channel - subscribe method:
def subscribed
ActionCable.server.pubsub.redis_connection_for_subscriptions.sadd "#{room.id}_users", current_user.id
stream_for room
broadcast_to room, { message: "#{current_user.firstname} is here ...", status: 'joining', id: current_user.id }
end
When using the channel in development, the user is added to the redis set. However when testing the channel I run into the following:
Error
NoMethodError: undefined method 'redis_connection_for_subscriptions' for #<ActionCable::SubscriptionAdapter::Test
I did some digging and found the 'redis_connection_for_subscriptions' method is in rails: https://github.com/rails/rails/blob/master/actioncable/lib/action_cable/subscription_adapter/redis.rb#L43
Has anyone came across this issue and found a fix?
Thanks in advance for any help