@@ -3,9 +3,10 @@ describe 'WebsocketRails.WebSocketConnection:', ->
3
3
dispatcher =
4
4
new_message : -> true
5
5
dispatch : -> true
6
- WebSocket = (url ) ->
6
+ # Have to stub the WebSocket object due to Firefox error during jasmine:ci
7
+ window .WebSocket = (url ) ->
7
8
@url = url
8
- @ send = ->
9
+ @ send = -> true
9
10
@connection = new WebSocketRails.WebSocketConnection (' localhost:3000/websocket' ,dispatcher)
10
11
11
12
describe ' constructor' , ->
@@ -29,6 +30,8 @@ describe 'WebsocketRails.WebSocketConnection:', ->
29
30
30
31
it ' should encode the data and send it through the WebSocket object' , ->
31
32
message = [' event' ,' message' ]
33
+ @connection ._conn =
34
+ send : -> true
32
35
mock_connection = sinon .mock @connection ._conn
33
36
mock_connection .expects (' send' ).once ().withArgs JSON .stringify (message)
34
37
@connection .trigger ' event' , ' message' , 123
@@ -38,6 +41,8 @@ describe 'WebsocketRails.WebSocketConnection:', ->
38
41
39
42
it ' should encode the data and send it through the WebSocket object' , ->
40
43
message = [' channel' ,' event' ,' message' ]
44
+ @connection ._conn =
45
+ send : -> true
41
46
mock_connection = sinon .mock @connection ._conn
42
47
mock_connection .expects (' send' ).once ().withArgs JSON .stringify (message)
43
48
@connection .trigger_channel ' channel' , ' event' , ' message' , 123
0 commit comments