diff options
author | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-04-28 18:01:22 +0300 |
---|---|---|
committer | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-04-28 18:01:22 +0300 |
commit | 97633d561681a5c0f55472c1372bedca5fe3bffe (patch) | |
tree | 2bf4f19e71b01f04452b37749692810369660ca6 /spec | |
parent | 0e8afe1343497165bf609a840306ce26c6136a7b (diff) |
Fixed specs
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/raven_js_spec.rb | 4 | ||||
-rw-r--r-- | spec/javascripts/raven/raven_config_spec.js | 28 |
2 files changed, 17 insertions, 15 deletions
diff --git a/spec/features/raven_js_spec.rb b/spec/features/raven_js_spec.rb index 74df52d80a7..0fe1c28bf8d 100644 --- a/spec/features/raven_js_spec.rb +++ b/spec/features/raven_js_spec.rb @@ -10,8 +10,7 @@ feature 'RavenJS', :feature, :js do end it 'should load raven if sentry is enabled' do - allow_any_instance_of(SentryHelper).to receive_messages(sentry_dsn_public: 'https://key@domain.com/id', - sentry_enabled?: true) + stub_application_setting(clientside_sentry_dsn: 'https://key@domain.com/id', clientside_sentry_enabled: true) visit new_user_session_path @@ -19,6 +18,7 @@ feature 'RavenJS', :feature, :js do end def has_requested_raven + p page.driver.network_traffic page.driver.network_traffic.one? {|request| request.url.end_with?(raven_path)} end end diff --git a/spec/javascripts/raven/raven_config_spec.js b/spec/javascripts/raven/raven_config_spec.js index 78251b4f61b..b4c35420f90 100644 --- a/spec/javascripts/raven/raven_config_spec.js +++ b/spec/javascripts/raven/raven_config_spec.js @@ -77,6 +77,7 @@ describe('RavenConfig', () => { describe('configure', () => { let options; let raven; + let ravenConfig; beforeEach(() => { options = { @@ -85,22 +86,25 @@ describe('RavenConfig', () => { isProduction: true, }; + ravenConfig = jasmine.createSpyObj('ravenConfig', ['shouldSendSample']); raven = jasmine.createSpyObj('raven', ['install']); spyOn(Raven, 'config').and.returnValue(raven); - RavenConfig.configure.call({ - options, - }); + ravenConfig.options = options; + ravenConfig.IGNORE_ERRORS = 'ignore_errors'; + ravenConfig.IGNORE_URLS = 'ignore_urls'; + + RavenConfig.configure.call(ravenConfig); }); it('should call Raven.config', () => { expect(Raven.config).toHaveBeenCalledWith(options.sentryDsn, { whitelistUrls: options.whitelistUrls, environment: 'production', - ignoreErrors: Raven.IGNORE_ERRORS, - ignoreUrls: Raven.IGNORE_URLS, - shouldSendCallback: Raven.shouldSendSample, + ignoreErrors: ravenConfig.IGNORE_ERRORS, + ignoreUrls: ravenConfig.IGNORE_URLS, + shouldSendCallback: jasmine.any(Function), }); }); @@ -109,18 +113,16 @@ describe('RavenConfig', () => { }); it('should set .environment to development if isProduction is false', () => { - options.isProduction = false; + ravenConfig.options.isProduction = false; - RavenConfig.configure.call({ - options, - }); + RavenConfig.configure.call(ravenConfig); expect(Raven.config).toHaveBeenCalledWith(options.sentryDsn, { whitelistUrls: options.whitelistUrls, environment: 'development', - ignoreErrors: Raven.IGNORE_ERRORS, - ignoreUrls: Raven.IGNORE_URLS, - shouldSendCallback: Raven.shouldSendSample, + ignoreErrors: ravenConfig.IGNORE_ERRORS, + ignoreUrls: ravenConfig.IGNORE_URLS, + shouldSendCallback: jasmine.any(Function), }); }); }); |