File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,25 @@ def initialize(identifiers = {})
62
62
def transmit ( cable_message )
63
63
transmissions << cable_message . with_indifferent_access
64
64
end
65
+
66
+ def connection_identifier
67
+ unless defined? @connection_identifier
68
+ @connection_identifier = connection_gid identifiers . filter_map { |id | send ( id . to_sym ) if id }
69
+ end
70
+
71
+ @connection_identifier
72
+ end
73
+
74
+ private
75
+ def connection_gid ( ids )
76
+ ids . map do |o |
77
+ if o . respond_to? :to_gid_param
78
+ o . to_gid_param
79
+ else
80
+ o . to_s
81
+ end
82
+ end . sort . join ( ":" )
83
+ end
65
84
end
66
85
67
86
# Superclass for Action Cable channel functional tests.
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ def test_connection_identifiers
62
62
63
63
assert_equal "John" , subscription . username
64
64
assert subscription . admin
65
+ assert_equal "John:true" , connection . connection_identifier
65
66
end
66
67
end
67
68
You can’t perform that action at this time.
0 commit comments