server_test.rb 755 字节
Newer Older
1 2
require 'test_helper'

3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
# FIXME: Currently busted.
#
# class ServerTest < ActionCableTest
#   class ChatChannel < ActionCable::Channel::Base
#   end
# 
#   class ChatServer < ActionCable::Server::Base
#     register_channels ChatChannel
#   end
# 
#   def app
#     ChatServer
#   end
# 
#   test "channel registration" do
#     assert_equal ChatServer.channel_classes, Set.new([ ChatChannel ])
#   end
# 
#   test "subscribing to a channel with valid params" do
#     ws = Faye::WebSocket::Client.new(websocket_url)
# 
#     ws.on(:message) do |message|
#       puts message.inspect
#     end
# 
#     ws.send command: 'subscribe', identifier: { channel: 'chat'}.to_json
#   end
# 
#   test "subscribing to a channel with invalid params" do
#   end
# end