diff options
author | Stan Hu <stanhu@gmail.com> | 2018-09-12 05:55:29 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-09-12 13:29:33 -0700 |
commit | 775081ba56baf473f580437d4b6ea2d7b8a39c43 (patch) | |
tree | 28782396a01445b117595a4d043291d6ba14f165 /spec/models | |
parent | fb81210ba7079ede4451d979b8da92fcdf04a17c (diff) | |
download | gitlab-ce-775081ba56baf473f580437d4b6ea2d7b8a39c43.tar.gz |
Strip whitespace from Sentry URL
Adding extra whitespace in the DSN could prevent the server from
starting due to InvalidURIErrors in sentry-raven.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/49621
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/application_setting_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb index 483cc546423..9647c1b9f63 100644 --- a/spec/models/application_setting_spec.rb +++ b/spec/models/application_setting_spec.rb @@ -305,6 +305,36 @@ 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]) |