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
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/application_setting_spec.rb')
-rw-r--r--spec/models/application_setting_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb
index bac9b58056b..b0c7f8c6dfc 100644
--- a/spec/models/application_setting_spec.rb
+++ b/spec/models/application_setting_spec.rb
@@ -1650,4 +1650,29 @@ RSpec.describe ApplicationSetting, feature_category: :shared, type: :model do
expect(setting.personal_access_tokens_disabled?).to eq(false)
end
end
+
+ describe '#ai_access_token' do
+ context 'when `instance_level_code_suggestions_enabled` is true' do
+ before do
+ setting.instance_level_code_suggestions_enabled = true
+ end
+
+ it { is_expected.not_to allow_value(nil).for(:ai_access_token) }
+ end
+
+ context 'when `instance_level_code_suggestions_enabled` is false' do
+ before do
+ setting.instance_level_code_suggestions_enabled = false
+ end
+
+ it { is_expected.to allow_value(nil).for(:ai_access_token) }
+ end
+
+ it 'does not modify the token if it is unchanged in the form' do
+ setting.ai_access_token = 'foo'
+ setting.ai_access_token = ApplicationSettingMaskedAttrs::MASK
+
+ expect(setting.ai_access_token).to eq('foo')
+ end
+ end
end