aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/test/javascript/src/test_helpers/consumer_test_helper.coffee
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2016-11-21 16:24:03 +0100
committerGitHub <noreply@github.com>2016-11-21 16:24:03 +0100
commitbb2a832b9b063c41864c0490ca0ed6fee59eb2e4 (patch)
tree3f99ac7b04a6667e25c956f94277690242336096 /actioncable/test/javascript/src/test_helpers/consumer_test_helper.coffee
parente49237387bf9a2778d5c92c5a5590e86fddfbc7e (diff)
parent7083fa27a4151e063b750249ae7902104a897968 (diff)
downloadrails-bb2a832b9b063c41864c0490ca0ed6fee59eb2e4.tar.gz
rails-bb2a832b9b063c41864c0490ca0ed6fee59eb2e4.tar.bz2
rails-bb2a832b9b063c41864c0490ca0ed6fee59eb2e4.zip
Merge pull request #27123 from javan/actioncable/js-test-updates
Action Cable: JavaScript test updates
Diffstat (limited to 'actioncable/test/javascript/src/test_helpers/consumer_test_helper.coffee')
-rw-r--r--actioncable/test/javascript/src/test_helpers/consumer_test_helper.coffee10
1 files changed, 10 insertions, 0 deletions
diff --git a/actioncable/test/javascript/src/test_helpers/consumer_test_helper.coffee b/actioncable/test/javascript/src/test_helpers/consumer_test_helper.coffee
index 6b145dede8..a9e95c37f0 100644
--- a/actioncable/test/javascript/src/test_helpers/consumer_test_helper.coffee
+++ b/actioncable/test/javascript/src/test_helpers/consumer_test_helper.coffee
@@ -21,6 +21,16 @@ TestHelpers.consumerTest = (name, options = {}, callback) ->
assert.equal clients.length, 1
assert.equal clients[0].readyState, WebSocket.OPEN
+ server.broadcastTo = (subscription, data = {}, callback) ->
+ data.identifier = subscription.identifier
+
+ if data.message_type
+ data.type = ActionCable.INTERNAL.message_types[data.message_type]
+ delete data.message_type
+
+ server.send(JSON.stringify(data))
+ TestHelpers.defer(callback)
+
done = ->
consumer.disconnect()
server.close()