blob: 3fe07adb4ae355e619ea5b338fdfe32ae9715de4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# frozen_string_literal: true
require "test_helper"
require_relative "common"
class ActionCable::SubscriptionAdapter::TestTest < ActionCable::TestCase
include CommonSubscriptionAdapterTest
def setup
super
@tx_adapter.shutdown
@tx_adapter = @rx_adapter
end
def cable_config
{ adapter: "test" }
end
test "#broadcast stores messages for streams" do
@tx_adapter.broadcast("channel", "payload")
@tx_adapter.broadcast("channel2", "payload2")
assert_equal ["payload"], @tx_adapter.broadcasts("channel")
assert_equal ["payload2"], @tx_adapter.broadcasts("channel2")
end
test "#clear_messages deletes recorded broadcasts for the channel" do
@tx_adapter.broadcast("channel", "payload")
@tx_adapter.broadcast("channel2", "payload2")
@tx_adapter.clear_messages("channel")
assert_equal [], @tx_adapter.broadcasts("channel")
assert_equal ["payload2"], @tx_adapter.broadcasts("channel2")
end
test "#clear deletes all recorded broadcasts" do
@tx_adapter.broadcast("channel", "payload")
@tx_adapter.broadcast("channel2", "payload2")
@tx_adapter.clear
assert_equal [], @tx_adapter.broadcasts("channel")
assert_equal [], @tx_adapter.broadcasts("channel2")
end
end
|