diff options
author | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-04-15 12:29:46 +0100 |
---|---|---|
committer | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-04-15 12:34:13 +0100 |
commit | 86b4f49c8c76a322d2f12f61e5a2d27d3c5c4671 (patch) | |
tree | 3c4a65f14ad81b80e8cd62d3df47d0eae19562d2 /spec/javascripts/raven | |
parent | 69e49a095ded719ccfb1287b6100646663de3f03 (diff) | |
download | gitlab-ce-86b4f49c8c76a322d2f12f61e5a2d27d3c5c4671.tar.gz |
Removed rewire and fixed tests
Diffstat (limited to 'spec/javascripts/raven')
-rw-r--r-- | spec/javascripts/raven/raven_config_spec.js | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/spec/javascripts/raven/raven_config_spec.js b/spec/javascripts/raven/raven_config_spec.js index b8bb558d22e..55f3949c740 100644 --- a/spec/javascripts/raven/raven_config_spec.js +++ b/spec/javascripts/raven/raven_config_spec.js @@ -1,5 +1,5 @@ import Raven from 'raven-js'; -import RavenConfig, { __RewireAPI__ as RavenConfigRewire } from '~/raven/raven_config'; +import RavenConfig from '~/raven/raven_config'; describe('RavenConfig', () => { describe('init', () => { @@ -122,13 +122,13 @@ describe('RavenConfig', () => { $document = jasmine.createSpyObj('$document', ['on']); $ = jasmine.createSpy('$').and.returnValue($document); - RavenConfigRewire.__set__('$', $); + window.$ = $; RavenConfig.bindRavenErrors(); }); it('should query for document using jquery', () => { - expect($).toHaveBeenCalledWith(document); + expect(window.$).toHaveBeenCalledWith(document); }); it('should call .on', function () { @@ -188,5 +188,29 @@ describe('RavenConfig', () => { }); }); }); + + describe('if no req.responseText is provided', () => { + beforeEach(() => { + req.responseText = undefined; + + Raven.captureMessage.calls.reset(); + + RavenConfig.handleRavenErrors(event, req, config, err); + }); + + it('should use `Unknown response text` as the response', () => { + expect(Raven.captureMessage).toHaveBeenCalledWith(err, { + extra: { + type: config.type, + url: config.url, + data: config.data, + status: req.status, + response: 'Unknown response text', + error: err, + event, + }, + }); + }); + }); }); }); |