aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/test/channel/broadcasting_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actioncable/test/channel/broadcasting_test.rb')
-rw-r--r--actioncable/test/channel/broadcasting_test.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/actioncable/test/channel/broadcasting_test.rb b/actioncable/test/channel/broadcasting_test.rb
index ab58f33511..f184147c51 100644
--- a/actioncable/test/channel/broadcasting_test.rb
+++ b/actioncable/test/channel/broadcasting_test.rb
@@ -1,10 +1,13 @@
# frozen_string_literal: true
require "test_helper"
+require "active_support/testing/method_call_assertions"
require "stubs/test_connection"
require "stubs/room"
class ActionCable::Channel::BroadcastingTest < ActiveSupport::TestCase
+ include ActiveSupport::Testing::MethodCallAssertions
+
class ChatChannel < ActionCable::Channel::Base
end
@@ -13,8 +16,16 @@ class ActionCable::Channel::BroadcastingTest < ActiveSupport::TestCase
end
test "broadcasts_to" do
- ActionCable.stubs(:server).returns mock().tap { |m| m.expects(:broadcast).with("action_cable:channel:broadcasting_test:chat:Room#1-Campfire", "Hello World") }
- ChatChannel.broadcast_to(Room.new(1), "Hello World")
+ assert_called_with(
+ ActionCable.server,
+ :broadcast,
+ [
+ "action_cable:channel:broadcasting_test:chat:Room#1-Campfire",
+ "Hello World"
+ ]
+ ) do
+ ChatChannel.broadcast_to(Room.new(1), "Hello World")
+ end
end
test "broadcasting_for with an object" do