Commit 47ee5125 authored by Andrei Gliga's avatar Andrei Gliga

validate disabled_oauth_sign_in_sources in ApplicationSe

parent 7c7c5b7e
......@@ -119,6 +119,16 @@ class ApplicationSetting < ActiveRecord::Base
end
end
validates_each :disabled_oauth_sign_in_sources do |record, attr, value|
unless value.nil?
value.each do |source|
unless Devise.omniauth_providers.include?(source.to_sym)
record.errors.add(attr, "'#{source}' is not an ouath sign-in source")
end
end
end
end
before_save :ensure_runners_registration_token
after_commit do
......
......@@ -20,6 +20,9 @@ describe ApplicationSetting, models: true do
it { is_expected.to allow_value(https).for(:after_sign_out_path) }
it { is_expected.not_to allow_value(ftp).for(:after_sign_out_path) }
it { is_expected.to allow_value([:github]).for(:disabled_oauth_sign_in_sources) }
it { is_expected.not_to allow_value([:test]).for(:disabled_oauth_sign_in_sources) }
it { is_expected.to validate_presence_of(:max_attachment_size) }
it do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment