diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2016-11-21 16:24:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-21 16:24:03 +0100 |
commit | bb2a832b9b063c41864c0490ca0ed6fee59eb2e4 (patch) | |
tree | 3f99ac7b04a6667e25c956f94277690242336096 /actioncable/test/javascript/src/test_helpers/consumer_test_helper.coffee | |
parent | e49237387bf9a2778d5c92c5a5590e86fddfbc7e (diff) | |
parent | 7083fa27a4151e063b750249ae7902104a897968 (diff) | |
download | rails-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.coffee | 10 |
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() |