     extra = {foo: 'bar'}
     extra = _.extend extra, {circular: extra}
     @sentry.error new Error('Error message'), '/path/to/logger', 'culprit', extra
-    scope.done()
 
   it 'send message correctly', ->
-    scope = nock('https://app.getsentry.com')
+    @scope = nock('https://app.getsentry.com')
       .matchHeader('X-Sentry-Auth'
       , "Sentry sentry_version=4, sentry_key=#{sentry_settings.key}, sentry_secret=#{sentry_settings.secret}, sentry_client=sentry-node")
       .filteringRequestBody (path) ->

      .reply(200, {"id": "534f9b1b491241b28ee8d6b571e1999d"}) # mock sentry response with a random uuid

    @sentry.error 'not an Error', 'path/to/logger', 'culprit'
    scope.done()

  it 'send error correctly', ->
    scope = nock('https://app.getsentry.com')
      .matchHeader('X-Sentry-Auth'
      , "Sentry sentry_version=4, sentry_key=#{sentry_settings.key}, sentry_secret=#{sentry_settings.secret}, sentry_client=sentry-node")
      .filteringRequestBody (path) ->


  # mock sentry dsn with random uuid as public_key and secret_key
  dsn = 'https://1234567890abcdef:fedcba0987654321@app.getsentry.com/12345'

  beforeEach -> @scope = null
  afterEach -> @scope?.done()

  it 'setup sentry client from specified DSN correctly', ->
    _sentry = new Sentry dsn
