1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Reorganize MockWebSocket

This commit is contained in:
Jon Moss 2016-05-27 14:37:26 -04:00
parent 66901c1849
commit fb0f0c7f6e
2 changed files with 32 additions and 22 deletions

View file

@ -1,10 +1,11 @@
#= require mock-socket
ActionCable.TestHelpers.MockWebSocket = MockWebSocket
server = null
consumer = null
ActionCable.TestHelpers.createConsumer = (url, callback) ->
ActionCable.WebSocket = MockWebSocket
server = new MockServer url
consumer = ActionCable.createConsumer(url)
callback(consumer, server)

View file

@ -1,7 +1,16 @@
{module, test} = QUnit
{testURL, createConsumer} = ActionCable.TestHelpers
{testURL, MockWebSocket, createConsumer} = ActionCable.TestHelpers
module "ActionCable.Consumer", ->
module 'with MockWebSocket', (hooks) ->
originalWebSocket = ActionCable.WebSocket
hooks.beforeEach ->
ActionCable.WebSocket = MockWebSocket
hooks.afterEach ->
ActionCable.WebSocket = originalWebSocket
test "#connect", (assert) ->
done = assert.async()