diff options
Diffstat (limited to 'test/channel/stream_test.rb')
-rw-r--r-- | test/channel/stream_test.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/channel/stream_test.rb b/test/channel/stream_test.rb new file mode 100644 index 0000000000..2f4c988adf --- /dev/null +++ b/test/channel/stream_test.rb @@ -0,0 +1,25 @@ +require 'test_helper' +require 'stubs/test_connection' + +class ActionCable::Channel::StreamTest < ActiveSupport::TestCase + Room = Struct.new(:id) + + class ChatChannel < ActionCable::Channel::Base + def subscribed + @room = Room.new params[:id] + stream_from "test_room_#{@room.id}" + end + end + + setup do + @connection = TestConnection.new + end + + test "streaming start and stop" do + @connection.expects(:pubsub).returns mock().tap { |m| m.expects(:subscribe) } + channel = ChatChannel.new @connection, "{id: 1}", { id: 1 } + + @connection.expects(:pubsub).returns mock().tap { |m| m.expects(:unsubscribe_proc) } + channel.unsubscribe_from_channel + end +end |