summaryrefslogtreecommitdiff
path: root/spec/javascripts
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/raven/index_spec.js42
-rw-r--r--spec/javascripts/raven/raven_config_spec.js13
-rw-r--r--spec/javascripts/spec_helper.js49
3 files changed, 37 insertions, 67 deletions
diff --git a/spec/javascripts/raven/index_spec.js b/spec/javascripts/raven/index_spec.js
index 51e84a6dbee..efde37b1f8e 100644
--- a/spec/javascripts/raven/index_spec.js
+++ b/spec/javascripts/raven/index_spec.js
@@ -1,11 +1,41 @@
-import RavenConfig from '~/raven/index';
+import RavenConfig from '~/raven/raven_config';
+import index from '~/raven/index';
-describe('RavenConfig options', () => {
- it('should set sentryDsn');
+fdescribe('RavenConfig options', () => {
+ let sentryDsn;
+ let currentUserId;
+ let gitlabUrl;
+ let isProduction;
+ let indexReturnValue;
- it('should set currentUserId');
+ beforeEach(() => {
+ sentryDsn = 'sentryDsn';
+ currentUserId = 'currentUserId';
+ gitlabUrl = 'gitlabUrl';
+ isProduction = 'isProduction';
- it('should set whitelistUrls');
+ window.gon = {
+ sentry_dsn: sentryDsn,
+ current_user_id: currentUserId,
+ gitlab_url: gitlabUrl,
+ is_production: isProduction,
+ };
- it('should set isProduction');
+ spyOn(RavenConfig.init, 'bind');
+
+ indexReturnValue = index();
+ });
+
+ it('should init with .sentryDsn, .currentUserId, .whitelistUrls and .isProduction', () => {
+ expect(RavenConfig.init.bind).toHaveBeenCalledWith(RavenConfig, {
+ sentryDsn,
+ currentUserId,
+ whitelistUrls: [gitlabUrl],
+ isProduction,
+ });
+ });
+
+ it('should return RavenConfig', () => {
+ expect(indexReturnValue).toBe(RavenConfig);
+ });
});
diff --git a/spec/javascripts/raven/raven_config_spec.js b/spec/javascripts/raven/raven_config_spec.js
index 2b63f56d719..64cf63702bc 100644
--- a/spec/javascripts/raven/raven_config_spec.js
+++ b/spec/javascripts/raven/raven_config_spec.js
@@ -1,8 +1,7 @@
import Raven from 'raven-js';
import RavenConfig from '~/raven/raven_config';
-import ClassSpecHelper from '../helpers/class_spec_helper';
-fdescribe('RavenConfig', () => {
+describe('RavenConfig', () => {
describe('init', () => {
beforeEach(() => {
spyOn(RavenConfig, 'configure');
@@ -10,8 +9,6 @@ fdescribe('RavenConfig', () => {
spyOn(RavenConfig, 'setUser');
});
- ClassSpecHelper.itShouldBeAStaticMethod(RavenConfig, 'init');
-
describe('when called', () => {
let options;
@@ -58,8 +55,6 @@ fdescribe('RavenConfig', () => {
});
describe('configure', () => {
- ClassSpecHelper.itShouldBeAStaticMethod(RavenConfig, 'configure');
-
describe('when called', () => {
let options;
let raven;
@@ -112,24 +107,18 @@ fdescribe('RavenConfig', () => {
});
describe('setUser', () => {
- ClassSpecHelper.itShouldBeAStaticMethod(RavenConfig, 'setUser');
-
describe('when called', () => {
beforeEach(() => {});
});
});
describe('bindRavenErrors', () => {
- ClassSpecHelper.itShouldBeAStaticMethod(RavenConfig, 'bindRavenErrors');
-
describe('when called', () => {
beforeEach(() => {});
});
});
describe('handleRavenErrors', () => {
- ClassSpecHelper.itShouldBeAStaticMethod(RavenConfig, 'handleRavenErrors');
-
describe('when called', () => {
beforeEach(() => {});
});
diff --git a/spec/javascripts/spec_helper.js b/spec/javascripts/spec_helper.js
deleted file mode 100644
index ee6e6279ac9..00000000000
--- a/spec/javascripts/spec_helper.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/* eslint-disable space-before-function-paren */
-// PhantomJS (Teaspoons default driver) doesn't have support for
-// Function.prototype.bind, which has caused confusion. Use this polyfill to
-// avoid the confusion.
-/*= require support/bind-poly */
-
-// You can require your own javascript files here. By default this will include
-// everything in application, however you may get better load performance if you
-// require the specific files that are being used in the spec that tests them.
-/*= require jquery */
-/*= require jquery.turbolinks */
-/*= require bootstrap */
-/*= require underscore */
-/*= require es6-promise.auto */
-
-// Teaspoon includes some support files, but you can use anything from your own
-// support path too.
-// require support/jasmine-jquery-1.7.0
-// require support/jasmine-jquery-2.0.0
-/*= require support/jasmine-jquery-2.1.0 */
-
-// require support/sinon
-// require support/your-support-file
-// Deferring execution
-// If you're using CommonJS, RequireJS or some other asynchronous library you can
-// defer execution. Call Teaspoon.execute() after everything has been loaded.
-// Simple example of a timeout:
-// Teaspoon.defer = true
-// setTimeout(Teaspoon.execute, 1000)
-// Matching files
-// By default Teaspoon will look for files that match
-// _spec.{js,js.es6}. Add a filename_spec.js file in your spec path
-// and it'll be included in the default suite automatically. If you want to
-// customize suites, check out the configuration in teaspoon_env.rb
-// Manifest
-// If you'd rather require your spec files manually (to control order for
-// instance) you can disable the suite matcher in the configuration and use this
-// file as a manifest.
-// For more information: http://github.com/modeset/teaspoon
-
-// set our fixtures path
-jasmine.getFixtures().fixturesPath = '/teaspoon/fixtures';
-jasmine.getJSONFixtures().fixturesPath = '/teaspoon/fixtures';
-
-// defined in ActionDispatch::TestRequest
-// see https://github.com/rails/rails/blob/v4.2.7.1/actionpack/lib/action_dispatch/testing/test_request.rb#L7
-window.gl = window.gl || {};
-window.gl.TEST_HOST = 'http://test.host';
-window.gon = window.gon || {};