diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/connection/identifier_test.rb | 4 | ||||
-rw-r--r-- | test/connection/subscriptions_test.rb | 6 | ||||
-rw-r--r-- | test/test_helper.rb | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/test/connection/identifier_test.rb b/test/connection/identifier_test.rb index f34b66f9fd..02e6b21845 100644 --- a/test/connection/identifier_test.rb +++ b/test/connection/identifier_test.rb @@ -40,7 +40,7 @@ class ActionCable::Connection::IdentifierTest < ActionCable::TestCase open_connection_with_stubbed_pubsub @connection.websocket.expects(:close) - message = { 'type' => 'disconnect' }.to_json + message = ActiveSupport::JSON.encode('type' => 'disconnect') @connection.process_internal_message message end end @@ -50,7 +50,7 @@ class ActionCable::Connection::IdentifierTest < ActionCable::TestCase open_connection_with_stubbed_pubsub @connection.websocket.expects(:close).never - message = { 'type' => 'unknown' }.to_json + message = ActiveSupport::JSON.encode('type' => 'unknown') @connection.process_internal_message message end end diff --git a/test/connection/subscriptions_test.rb b/test/connection/subscriptions_test.rb index 55ad74b962..4f6760827e 100644 --- a/test/connection/subscriptions_test.rb +++ b/test/connection/subscriptions_test.rb @@ -27,7 +27,7 @@ class ActionCable::Connection::SubscriptionsTest < ActionCable::TestCase @server = TestServer.new @server.stubs(:channel_classes).returns(ChatChannel.name => ChatChannel) - @chat_identifier = { id: 1, channel: 'ActionCable::Connection::SubscriptionsTest::ChatChannel' }.to_json + @chat_identifier = ActiveSupport::JSON.encode(id: 1, channel: 'ActionCable::Connection::SubscriptionsTest::ChatChannel') end test "subscribe command" do @@ -77,7 +77,7 @@ class ActionCable::Connection::SubscriptionsTest < ActionCable::TestCase channel = subscribe_to_chat_channel data = { 'content' => 'Hello World!', 'action' => 'speak' } - @subscriptions.execute_command 'command' => 'message', 'identifier' => @chat_identifier, 'data' => data.to_json + @subscriptions.execute_command 'command' => 'message', 'identifier' => @chat_identifier, 'data' => ActiveSupport::JSON.encode(data) assert_equal [ data ], channel.lines end @@ -89,7 +89,7 @@ class ActionCable::Connection::SubscriptionsTest < ActionCable::TestCase channel1 = subscribe_to_chat_channel - channel2_id = { id: 2, channel: 'ActionCable::Connection::SubscriptionsTest::ChatChannel' }.to_json + channel2_id = ActiveSupport::JSON.encode(id: 2, channel: 'ActionCable::Connection::SubscriptionsTest::ChatChannel') channel2 = subscribe_to_chat_channel(channel2_id) channel1.expects(:unsubscribe_from_channel) diff --git a/test/test_helper.rb b/test/test_helper.rb index b9cb34f891..34c7def46b 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -18,10 +18,12 @@ ActiveSupport.test_order = :sorted # Require all the stubs and models Dir[File.dirname(__FILE__) + '/stubs/*.rb'].each {|file| require file } +require 'celluloid' $CELLULOID_DEBUG = false $CELLULOID_TEST = false Celluloid.logger = Logger.new(StringIO.new) +require 'faye/websocket' class << Faye::WebSocket remove_method :ensure_reactor_running |