   it 'subscribes to account and streams it', (done) ->
     world.given.fakeWebSocketConstructor()
 
-    testSubject = transactionStream(world.fakeWebSocketConstructor, 'gDSSa75HPagWcvQmwH7D51dT5DPmvsKL4q')
+    stream = transactionStream(world.fakeWebSocketConstructor, 'gDSSa75HPagWcvQmwH7D51dT5DPmvsKL4q')
 
     assert(world.fakeWebSocketConstructor.calledWithNew())
     assert(world.fakeWebSocketConstructor.calledWith('ws://live.stellar.org:9001'))


    world.given.fakeWebSocketConstructor()

    testSubject = transactionStream(world.fakeWebSocketConstructor, 'gDSSa75HPagWcvQmwH7D51dT5DPmvsKL4q')

    clock.tick 50

    world.fakeWebSocketInstance.fakeEmit 'open'

    fakeError = new Error()
    testSubject.on 'error', (error) ->
      assert.equal fakeError, error
      done()



    clock.tick 100

    stream.on 'error', -> assert.fail('should not call error')

    world.fakeWebSocketInstance.send.yield null

    assert(world.fakeWebSocketInstance.send.calledWith(
      JSON.stringify({ "command" : "subscribe",   "accounts" : [ "gDSSa75HPagWcvQmwH7D51dT5DPmvsKL4q" ] })))

    stream.on 'data', (data) ->
      assert.deepEqual data,
        from: "gDSSa75HPagWcvQmwH7D51dT5DPmvsKL4q"
        to: "gM8ZuCaGB7GkCiLz7rW941boyVT2vW1ppT"
