Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/features/raven_js_spec.rb2
-rw-r--r--spec/models/application_setting_spec.rb30
-rw-r--r--spec/requests/api/helpers_spec.rb6
-rw-r--r--spec/support/helpers/stub_configuration.rb6
-rw-r--r--spec/support/shared_examples/application_setting_examples.rb39
5 files changed, 9 insertions, 74 deletions
diff --git a/spec/features/raven_js_spec.rb b/spec/features/raven_js_spec.rb
index 9a049764dec..a4dd79b3179 100644
--- a/spec/features/raven_js_spec.rb
+++ b/spec/features/raven_js_spec.rb
@@ -10,7 +10,7 @@ describe 'RavenJS' do
end
it 'loads raven if sentry is enabled' do
- stub_application_setting(clientside_sentry_dsn: 'https://key@domain.com/id', clientside_sentry_enabled: true)
+ stub_sentry_settings
visit new_user_session_path
diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb
index f8dc1541dd3..ab6f6dfe720 100644
--- a/spec/models/application_setting_spec.rb
+++ b/spec/models/application_setting_spec.rb
@@ -354,36 +354,6 @@ describe ApplicationSetting do
end
end
- describe 'setting Sentry DSNs' do
- context 'server DSN' do
- it 'strips leading and trailing whitespace' do
- subject.update(sentry_dsn: ' http://test ')
-
- expect(subject.sentry_dsn).to eq('http://test')
- end
-
- it 'handles nil values' do
- subject.update(sentry_dsn: nil)
-
- expect(subject.sentry_dsn).to be_nil
- end
- end
-
- context 'client-side DSN' do
- it 'strips leading and trailing whitespace' do
- subject.update(clientside_sentry_dsn: ' http://test ')
-
- expect(subject.clientside_sentry_dsn).to eq('http://test')
- end
-
- it 'handles nil values' do
- subject.update(clientside_sentry_dsn: nil)
-
- expect(subject.clientside_sentry_dsn).to be_nil
- end
- end
- end
-
describe '#disabled_oauth_sign_in_sources=' do
before do
allow(Devise).to receive(:omniauth_providers).and_return([:github])
diff --git a/spec/requests/api/helpers_spec.rb b/spec/requests/api/helpers_spec.rb
index ed907841bd8..1c69f5dbb67 100644
--- a/spec/requests/api/helpers_spec.rb
+++ b/spec/requests/api/helpers_spec.rb
@@ -226,10 +226,8 @@ describe API::Helpers do
allow_any_instance_of(self.class).to receive(:rack_response)
allow(Gitlab::Sentry).to receive(:enabled?).and_return(true)
- stub_application_setting(
- sentry_enabled: true,
- sentry_dsn: "dummy://12345:67890@sentry.localdomain/sentry/42"
- )
+ stub_sentry_settings
+
configure_sentry
Raven.client.configuration.encoding = 'json'
end
diff --git a/spec/support/helpers/stub_configuration.rb b/spec/support/helpers/stub_configuration.rb
index f6c613ad5aa..0d591f038ce 100644
--- a/spec/support/helpers/stub_configuration.rb
+++ b/spec/support/helpers/stub_configuration.rb
@@ -81,6 +81,12 @@ module StubConfiguration
allow(Gitlab.config.repositories).to receive(:storages).and_return(Settingslogic.new(messages))
end
+ def stub_sentry_settings
+ allow(Gitlab.config.sentry).to receive(:enabled).and_return(true)
+ allow(Gitlab.config.sentry).to receive(:dsn).and_return('dummy://b44a0828b72421a6d8e99efd68d44fa8@example.com/42')
+ allow(Gitlab.config.sentry).to receive(:clientside_dsn).and_return('dummy://b44a0828b72421a6d8e99efd68d44fa8@example.com/43')
+ end
+
def stub_kerberos_setting(messages)
allow(Gitlab.config.kerberos).to receive_messages(to_settings(messages))
end
diff --git a/spec/support/shared_examples/application_setting_examples.rb b/spec/support/shared_examples/application_setting_examples.rb
index 421303c97be..e7ec24c5b7e 100644
--- a/spec/support/shared_examples/application_setting_examples.rb
+++ b/spec/support/shared_examples/application_setting_examples.rb
@@ -249,43 +249,4 @@ RSpec.shared_examples 'application settings examples' do
expect(setting.password_authentication_enabled_for_web?).to be_falsey
end
-
- describe 'sentry settings' do
- context 'when the sentry settings are not set in gitlab.yml' do
- it 'fallbacks to the settings in the database' do
- setting.sentry_enabled = true
- setting.sentry_dsn = 'https://b44a0828b72421a6d8e99efd68d44fa8@example.com/40'
- setting.clientside_sentry_enabled = true
- setting.clientside_sentry_dsn = 'https://b44a0828b72421a6d8e99efd68d44fa8@example.com/41'
-
- allow(Gitlab.config.sentry).to receive(:enabled).and_return(false)
- allow(Gitlab.config.sentry).to receive(:dsn).and_return(nil)
- allow(Gitlab.config.sentry).to receive(:clientside_dsn).and_return(nil)
-
- expect(setting.sentry_enabled).to eq true
- expect(setting.sentry_dsn).to eq 'https://b44a0828b72421a6d8e99efd68d44fa8@example.com/40'
- expect(setting.clientside_sentry_enabled).to eq true
- expect(setting.clientside_sentry_dsn). to eq 'https://b44a0828b72421a6d8e99efd68d44fa8@example.com/41'
- end
- end
-
- context 'when the sentry settings are set in gitlab.yml' do
- it 'does not fallback to the settings in the database' do
- setting.sentry_enabled = false
- setting.sentry_dsn = 'https://b44a0828b72421a6d8e99efd68d44fa8@example.com/40'
- setting.clientside_sentry_enabled = false
- setting.clientside_sentry_dsn = 'https://b44a0828b72421a6d8e99efd68d44fa8@example.com/41'
-
- allow(Gitlab.config.sentry).to receive(:enabled).and_return(true)
- allow(Gitlab.config.sentry).to receive(:dsn).and_return('https://b44a0828b72421a6d8e99efd68d44fa8@example.com/42')
- allow(Gitlab.config.sentry).to receive(:clientside_dsn).and_return('https://b44a0828b72421a6d8e99efd68d44fa8@example.com/43')
-
- expect(setting).not_to receive(:read_attribute)
- expect(setting.sentry_enabled).to eq true
- expect(setting.sentry_dsn).to eq 'https://b44a0828b72421a6d8e99efd68d44fa8@example.com/42'
- expect(setting.clientside_sentry_enabled).to eq true
- expect(setting.clientside_sentry_dsn). to eq 'https://b44a0828b72421a6d8e99efd68d44fa8@example.com/43'
- end
- end
- end
end