aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/test
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2016-03-30 00:03:11 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2016-03-30 00:03:11 -0300
commitedbfd10876f938bd04b9034b1e4c4329cd4f2d2b (patch)
tree60306d702cb95cb0a3113db37b602eb0cf10ac2f /actioncable/test
parent6786718766f10ef25af427a43e47c15ee02dc7e5 (diff)
downloadrails-edbfd10876f938bd04b9034b1e4c4329cd4f2d2b.tar.gz
rails-edbfd10876f938bd04b9034b1e4c4329cd4f2d2b.tar.bz2
rails-edbfd10876f938bd04b9034b1e4c4329cd4f2d2b.zip
Keep logging in the ActionCable::Channel::Base
To move Action Cable logging to a LoggingSubscriber we need to pass the log tags in the notification payload since Action Cable logging use the Channel instance to tag the logs.
Diffstat (limited to 'actioncable/test')
-rw-r--r--actioncable/test/channel/log_subscriber_test.rb69
1 files changed, 0 insertions, 69 deletions
diff --git a/actioncable/test/channel/log_subscriber_test.rb b/actioncable/test/channel/log_subscriber_test.rb
deleted file mode 100644
index 18acdc9fbd..0000000000
--- a/actioncable/test/channel/log_subscriber_test.rb
+++ /dev/null
@@ -1,69 +0,0 @@
-require 'test_helper'
-require 'stubs/test_connection'
-require 'active_support/log_subscriber/test_helper'
-require 'action_cable/channel/log_subscriber'
-
-class ActionCable::Channel::LogSubscriberTest < ActiveSupport::TestCase
- include ActiveSupport::LogSubscriber::TestHelper
-
- class ChatChannel < ActionCable::Channel::Base
- attr_reader :last_action
-
- def speak(data)
- @last_action = [ :speak, data ]
- end
-
- def get_latest
- transmit data: 'latest'
- end
- end
-
- def setup
- super
- @connection = TestConnection.new
- @channel = ChatChannel.new @connection, "{id: 1}", { id: 1 }
- ActionCable::Channel::LogSubscriber.attach_to :action_cable
- end
-
- def test_perform_action
- data = {'action' => :speak, 'content' => 'hello'}
- @channel.perform_action(data)
- wait
-
- assert_equal(1, logs.size)
- assert_match(/Completed #{channel_class}#speak in \d+ms/, logs.first)
- end
-
- def test_transmit
- @channel.perform_action('action' => :get_latest)
- wait
-
- assert_equal(2, logs.size)
- assert_match(/^#{channel_class} transmitting/, logs.first)
- end
-
- def test_transmit_subscription_confirmation
- @channel.stubs(:subscription_confirmation_sent?).returns(false)
- @channel.send(:transmit_subscription_confirmation)
- wait
-
- assert_equal(1, logs.size)
- assert_equal("#{channel_class} is transmitting the subscription confirmation", logs.first)
- end
-
- def test_transmit_subscription_rejection
- @channel.send(:transmit_subscription_rejection)
- wait
-
- assert_equal(1, logs.size)
- assert_equal("#{channel_class} is transmitting the subscription rejection", logs.first)
- end
-
- def channel_class
- "ActionCable::Channel::LogSubscriberTest::ChatChannel"
- end
-
- def logs
- @logs ||= @logger.logged(:info)
- end
-end