diff options
author | Jon Moss <me@jonathanmoss.me> | 2016-05-27 13:07:13 -0400 |
---|---|---|
committer | Jon Moss <me@jonathanmoss.me> | 2016-05-31 13:06:08 -0400 |
commit | 66901c1849efae74c8a58fe0cb36afd487c067cc (patch) | |
tree | ee8c16cfe1668d937fc6f04cf450e9e7f7aacc78 /actioncable/test | |
parent | 998bbbcc0e043e16b96613387cdb8f0ee4784ff2 (diff) | |
download | rails-66901c1849efae74c8a58fe0cb36afd487c067cc.tar.gz rails-66901c1849efae74c8a58fe0cb36afd487c067cc.tar.bz2 rails-66901c1849efae74c8a58fe0cb36afd487c067cc.zip |
Add configuration for `WebSocket` and `logger`
[Javan Makhmali, Jon Moss]
Diffstat (limited to 'actioncable/test')
-rw-r--r-- | actioncable/test/javascript/src/test_helpers/mock_websocket.coffee | 5 | ||||
-rw-r--r-- | actioncable/test/javascript/src/unit/action_cable_test.coffee | 17 |
2 files changed, 18 insertions, 4 deletions
diff --git a/actioncable/test/javascript/src/test_helpers/mock_websocket.coffee b/actioncable/test/javascript/src/test_helpers/mock_websocket.coffee index b7f86f18f6..6508984c37 100644 --- a/actioncable/test/javascript/src/test_helpers/mock_websocket.coffee +++ b/actioncable/test/javascript/src/test_helpers/mock_websocket.coffee @@ -1,12 +1,10 @@ #= require mock-socket -NativeWebSocket = window.WebSocket - server = null consumer = null ActionCable.TestHelpers.createConsumer = (url, callback) -> - window.WebSocket = MockWebSocket + ActionCable.WebSocket = MockWebSocket server = new MockServer url consumer = ActionCable.createConsumer(url) callback(consumer, server) @@ -18,4 +16,3 @@ QUnit.testDone -> if server? server.clients().forEach (client) -> client.close() server.close() - window.WebSocket = NativeWebSocket diff --git a/actioncable/test/javascript/src/unit/action_cable_test.coffee b/actioncable/test/javascript/src/unit/action_cable_test.coffee index f9eff64769..3944f3a7f6 100644 --- a/actioncable/test/javascript/src/unit/action_cable_test.coffee +++ b/actioncable/test/javascript/src/unit/action_cable_test.coffee @@ -2,6 +2,23 @@ {testURL} = ActionCable.TestHelpers module "ActionCable", -> + module "Adapters", -> + module "WebSocket", -> + test "default is window.WebSocket", (assert) -> + assert.equal ActionCable.WebSocket, window.WebSocket + + test "configurable", (assert) -> + ActionCable.WebSocket = "" + assert.equal ActionCable.WebSocket, "" + + module "logger", -> + test "default is window.console", (assert) -> + assert.equal ActionCable.logger, window.console + + test "configurable", (assert) -> + ActionCable.logger = "" + assert.equal ActionCable.logger, "" + module "#createConsumer", -> test "uses specified URL", (assert) -> consumer = ActionCable.createConsumer(testURL) |