Skip to content
Snippets Groups Projects
Commit 17f9e75e authored by Gabriel Mazetto's avatar Gabriel Mazetto :red_circle:
Browse files

Add error_tracking_api_url validations and tests

parent c0e0d1cd
No related branches found
No related tags found
1 merge request!91148Add GitLab Error Tracking to /admin settings
......@@ -598,6 +598,7 @@ def self.kroki_formats_attributes
inclusion: { in: [true, false], message: _('must be a boolean value') }
validates :error_tracking_api_url,
presence: true,
addressable_url: true,
length: { maximum: 255 },
if: :error_tracking_enabled?
......
......@@ -1073,6 +1073,27 @@ def expect_invalid
is_expected.to validate_numericality_of(:metrics_method_call_threshold).is_greater_than_or_equal_to(0)
end
end
context 'error tracking settings' do
context 'with error tracking disabled' do
before do
setting.error_tracking_enabled = false
end
it { is_expected.to allow_value(nil).for(:error_tracking_api_url) }
end
context 'with error tracking enabled' do
before do
setting.error_tracking_enabled = true
end
it { is_expected.to allow_value(http).for(:error_tracking_api_url) }
it { is_expected.to allow_value(https).for(:error_tracking_api_url) }
it { is_expected.not_to allow_value(ftp).for(:error_tracking_api_url) }
it { is_expected.to validate_presence_of(:error_tracking_api_url) }
end
end
end
context 'restrict creating duplicates' do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment