diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-08 15:08:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-08 15:08:54 +0300 |
commit | 473b876fe3d7e0b36eb6268cc44a4fe0d94f4422 (patch) | |
tree | 2f6d5f2ecad53015024b6b1509896f5933c5c3e6 /spec/models/application_setting_spec.rb | |
parent | dca8df0c90d8727d69b3501b15b481546897f3cd (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/application_setting_spec.rb')
-rw-r--r-- | spec/models/application_setting_spec.rb | 25 |
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 |