Sha256: 24b395c82bb8157f0fe625222763db40ff5ed75e343fdcfb50e08c5a9adbc682

Contents?: true

Size: 1.21 KB

Versions: 4

Compression:

Stored size: 1.21 KB

Contents

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

  it '.supported returns false', -> expect( @klass.supported() ).toBe false
  it '.name throws error',       -> expect( -> @instance.name  ).toThrow()
  it '.stop throws error',       -> expect( -> @instance.stop  ).toThrow()

  describe 'constructor', ->
    it 'returns an instance',     -> expect( @instance             ).toEqual jasmine.any @klass
    it 'sets the @config object', -> expect( @instance.config      ).toEqual jasmine.any Object
    it 'sets a retry delay',      -> expect( @instance._retryDelay ).toEqual jasmine.any Number

  describe '#connect', ->
    it 'returns itself', -> expect( @instance.connect() ).toBe @instance

    describe 'when given a 500 delay', ->
      beforeEach ->
        @clock = sinon.useFakeTimers()
        sinon.stub @instance, '_request'
        @instance.connect 500

      afterEach -> @clock.restore()

      it 'does not call _request before the given delay', ->
        @clock.tick 499
        expect( @instance._request.called ).toBe false

      it 'calls _request after the given delay', ->
        @clock.tick 600
        expect( @instance._request.called ).toBe true

Version data entries

4 entries across 4 versions & 1 rubygems

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