mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Reorganize MockWebSocket
This commit is contained in:
parent
66901c1849
commit
fb0f0c7f6e
2 changed files with 32 additions and 22 deletions
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in a new issue