diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2015-12-18 13:22:49 -0200 |
---|---|---|
committer | Rafael França <rafaelmfranca@gmail.com> | 2015-12-18 13:22:49 -0200 |
commit | d51c04fa42ec64648239ddb2fd3a4401992a5ef3 (patch) | |
tree | 0ce4d3c5920ed37acba8ebab2858f4ae54f36ea0 | |
parent | eac2eea3e1452ee93db46049375c1f38164d3d33 (diff) | |
parent | fef41f40b61139af0a4acbcc0d81eb24d20c88b8 (diff) | |
download | rails-d51c04fa42ec64648239ddb2fd3a4401992a5ef3.tar.gz rails-d51c04fa42ec64648239ddb2fd3a4401992a5ef3.tar.bz2 rails-d51c04fa42ec64648239ddb2fd3a4401992a5ef3.zip |
Merge pull request #22666 from akshay-vishnoi/base_test_case
[ActionCable] test perform action with default action
-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 |