I am wondering how to test ActionCable channels.
Let\'s say I have the following chat channel:
class ChatChannel < ApplicationCable::Channel
def s
I would install and configure TCR gem for recording sockets interaction ('its like VCR for websockets')
A spec for this in your case might look something like this...
describe ChatChannel do
context ".subscribed" do
it "updates db and defines opens 2 streams for one channel" do
TCR.use_cassette("subscribed_action") do |cassette|
# ...
ChatChannel.subscribed
expect(cassette).to include "something ..."
end
end
end
end