 
     it "truncates large backtraces", ->
       largeString = Array(1024*6).join("a")
-      Reporter.send(largeString, filePath, 1)
+      window.onerror(largeString, filePath, 1)
 
       body = JSON.parse(Reporter.request.calls[0].args[0].body)
-      Reporter.send(largeString, 'file.coffee', 1)
+      window.onerror(largeString, 'file.coffee', 1)
       expect(body.events[0].exceptions[0].message.length).toBeLessThan largeString.length
 
   describe "when the exception is not from atom core", ->
     it "doesn't send a request with the proper options", ->
-      Reporter.send('message', 'file.coffee', 1)
+      window.onerror('message', 'file.coffee', 1)
       expect(Reporter.request).not.toHaveBeenCalled()

  beforeEach ->
    spyOn(Reporter, 'request')
    spyOn(atom, 'inDevMode').andReturn false # exceptions are never sent if atom is in dev mode

  describe "when the exception is from atom core", ->
    filePath = null

            at HTMLDivElement.<anonymous> (#{atom.config.resourcePath}/fuzzy-finder.coffee:10:15)
            at HTMLDivElement.jQuery.event.dispatch (#{atom.config.resourcePath}/node_modules/space-pen/vendor/jquery.js:4676:9)
        """
      window.onerror('message', filePath, 1, 2, error)
      expect(Reporter.request).toHaveBeenCalled()

      requestArgs = Reporter.request.calls[0].args[0]
