Sha256: 38f3519286b8243b9161b7290f0e6da626ed2495aa1c2831a7774cb6c926f264

Contents?: true

Size: 953 Bytes

Versions: 4

Compression:

Stored size: 953 Bytes

Contents

describe 'Firehose.WebSocket', ->
  beforeEach ->
    @klass    = Firehose.WebSocket
    @instance = new @klass()

  #= Specs ===

  it '.name returns a string',         -> expect( @instance.name() ).toEqual jasmine.any String
  it '.ieSupported returns a Boolean', -> expect( typeof @klass.ieSupported() ).toBe 'boolean'
  it '.supported returns a Boolean',   -> expect( typeof @klass.supported()   ).toBe 'boolean'

  describe 'callbacks', ->
    for callback in ['_request','_success','_ping','_error']
      it "has a #{callback} callback function", ->
        expect( @instance[callback] ).toEqual jasmine.any Function

  describe '#stop', ->
    beforeEach ->
      @instance.connect( uri: '//localhost/test' )._request()
      sinon.spy @instance.socket, 'close'
      Object.freeze @instance # stop _cleanUp method deleting the socket

    it 'closes the socket', ->
      @instance.stop()
      expect( @instance.socket.close.called ).toBe true

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
firehose-1.2.20 spec/javascripts/firehose/websocket_spec.coffee
firehose-1.2.13 spec/javascripts/firehose/websocket_spec.coffee
firehose-1.2.12 spec/javascripts/firehose/websocket_spec.coffee
firehose-1.2.11 spec/javascripts/firehose/websocket_spec.coffee