diff options
author | Jeremy Daer <jeremydaer@gmail.com> | 2015-10-16 01:02:22 -0700 |
---|---|---|
committer | Jeremy Daer <jeremydaer@gmail.com> | 2015-10-16 09:06:44 -0700 |
commit | acfdcf556888a88dc2d2026553d585f920fae105 (patch) | |
tree | 9e9bbe0a5b43170d3495653315fe396e546e6dd0 /test/connection/subscriptions_test.rb | |
parent | d7ab5c8f1ffd04acd2cf610f5756fc18fdfc6160 (diff) | |
download | rails-acfdcf556888a88dc2d2026553d585f920fae105.tar.gz rails-acfdcf556888a88dc2d2026553d585f920fae105.tar.bz2 rails-acfdcf556888a88dc2d2026553d585f920fae105.zip |
Devolve blanket #require to reveal intent and responsibility
* Move specific requires close to where they're needed.
* Use the private active_support/rails dep to wrap up common needs
like eager autoload and module delegation.
* Use a single Rails engine rather than an engine and a railtie.
* Prefer `AS::JSON.encode` to `Object#to_json`.
Diffstat (limited to 'test/connection/subscriptions_test.rb')
-rw-r--r-- | test/connection/subscriptions_test.rb | 6 |
1 files changed, 3 insertions, 3 deletions
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) |