diff options
author | Akshay Vishnoi <akshay.vishnoi@vinsol.com> | 2015-12-18 20:45:14 +0530 |
---|---|---|
committer | Akshay Vishnoi <akshay.vishnoi@vinsol.com> | 2015-12-18 20:45:43 +0530 |
commit | fef41f40b61139af0a4acbcc0d81eb24d20c88b8 (patch) | |
tree | bf4734373dabf84868541f22896798b79ba5fd3f /actioncable/test/channel | |
parent | 027d964d89d818bc63e5e35c94f2600096a8fc35 (diff) | |
download | rails-fef41f40b61139af0a4acbcc0d81eb24d20c88b8.tar.gz rails-fef41f40b61139af0a4acbcc0d81eb24d20c88b8.tar.bz2 rails-fef41f40b61139af0a4acbcc0d81eb24d20c88b8.zip |
[ActionCable] test perform action with default action
Diffstat (limited to 'actioncable/test/channel')
-rw-r--r-- | actioncable/test/channel/base_test.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/actioncable/test/channel/base_test.rb b/actioncable/test/channel/base_test.rb index 506d41d9a2..ec19d7de8e 100644 --- a/actioncable/test/channel/base_test.rb +++ b/actioncable/test/channel/base_test.rb @@ -61,6 +61,10 @@ class ActionCable::Channel::BaseTest < ActiveSupport::TestCase transmit data: 'latest' end + def receive + @last_action = [ :recieve ] + end + private def rm_rf @last_action = [ :rm_rf ] @@ -133,6 +137,12 @@ class ActionCable::Channel::BaseTest < ActiveSupport::TestCase assert_equal [ :chatters ], @channel.last_action end + test "should dispatch recieve action when perform_action is called with empty action" do + data = {'content' => 'hello'} + @channel.perform_action data + assert_equal [ :recieve ], @channel.last_action + end + test "transmitting data" do @channel.perform_action 'action' => :get_latest @@ -146,7 +156,7 @@ class ActionCable::Channel::BaseTest < ActiveSupport::TestCase end test "actions available on Channel" do - available_actions = ["room", "last_action", "subscribed", "unsubscribed", "toggle_subscribed", "leave", "speak", "subscribed?", "get_latest", "chatters", "topic"].to_set + 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 end |