aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2015-12-18 14:07:55 -0200
committerRafael França <rafaelmfranca@gmail.com>2015-12-18 14:07:55 -0200
commit905a2a176b0a512af9756df3970428749c4d5f41 (patch)
tree8f7050f21b4e031c540b8c78f7c5678e3d2c76c2 /actioncable
parent6a2c3c4c83b03d9c508e394ab8c5a636687d11f1 (diff)
parent46adddbfb55c9d7305c8e7b08a1fee22f5cfcebb (diff)
downloadrails-905a2a176b0a512af9756df3970428749c4d5f41.tar.gz
rails-905a2a176b0a512af9756df3970428749c4d5f41.tar.bz2
rails-905a2a176b0a512af9756df3970428749c4d5f41.zip
Merge pull request #22667 from akshay-vishnoi/base_test_case
[ActionCable] Test invalid action on channel
Diffstat (limited to 'actioncable')
-rw-r--r--actioncable/test/channel/base_test.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/actioncable/test/channel/base_test.rb b/actioncable/test/channel/base_test.rb
index c18ddc5218..d5997c0273 100644
--- a/actioncable/test/channel/base_test.rb
+++ b/actioncable/test/channel/base_test.rb
@@ -159,4 +159,26 @@ class ActionCable::Channel::BaseTest < ActiveSupport::TestCase
available_actions = %w(room last_action subscribed unsubscribed toggle_subscribed leave speak subscribed? get_latest receive chatters topic).to_set
assert_equal available_actions, ChatChannel.action_methods
end
+
+ test "invalid action on Channel" do
+ assert_logged("Unable to process ActionCable::Channel::BaseTest::ChatChannel#invalid_action") do
+ @channel.perform_action 'action' => :invalid_action
+ end
+ end
+
+ def assert_logged(message)
+ old_logger = @connection.logger
+ log = StringIO.new
+ @connection.instance_variable_set(:@logger, Logger.new(log))
+
+ begin
+ yield
+
+ log.rewind
+ assert_match message, log.read
+ ensure
+ @connection.instance_variable_set(:@logger, old_logger)
+ end
+ end
+
end