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:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-09-14 09:07:31 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-09-14 09:07:31 +0300
commitcbe10896a535341739629eb4c682d69cebd0d009 (patch)
tree3499345f8d7c6e8d0ac994df4d3be3ca314a10ad /spec/models/namespace_spec.rb
parent886077c08875d595fc88a689f1ac841252813513 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/namespace_spec.rb')
-rw-r--r--spec/models/namespace_spec.rb42
1 files changed, 42 insertions, 0 deletions
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb
index 37d967cbc7c..527265de18b 100644
--- a/spec/models/namespace_spec.rb
+++ b/spec/models/namespace_spec.rb
@@ -2148,6 +2148,48 @@ RSpec.describe Namespace, feature_category: :groups_and_projects do
end
end
+ describe '#first_auto_devops_config' do
+ let(:instance_autodevops_status) { Gitlab::CurrentSettings.auto_devops_enabled? }
+
+ context 'when namespace.auto_devops_enabled is not set' do
+ let(:group) { create(:group) }
+
+ it 'returns the config values using the instance setting' do
+ expect(group.first_auto_devops_config).to eq({ scope: :instance, status: instance_autodevops_status })
+ end
+
+ context 'when namespace does not have auto_deveops enabled but has a parent' do
+ let!(:parent) { create(:group, auto_devops_enabled: true) }
+ let!(:group) { create(:group, parent: parent) }
+
+ it 'returns the first_auto_devops_config of the parent' do
+ expect(parent).to receive(:first_auto_devops_config).and_call_original
+
+ expect(group.first_auto_devops_config).to eq({ scope: :group, status: true })
+ end
+
+ context 'then the parent is deleted' do
+ before do
+ parent.delete
+ group.reload
+ end
+
+ it 'returns its own config with status based on the instance settings' do
+ expect(group.first_auto_devops_config).to eq({ scope: :instance, status: instance_autodevops_status })
+ end
+ end
+ end
+ end
+
+ context 'when namespace.auto_devops_enable is set' do
+ let(:group) { create(:group, auto_devops_enabled: false) }
+
+ it 'returns the correct config values' do
+ expect(group.first_auto_devops_config).to eq({ scope: :group, status: false })
+ end
+ end
+ end
+
describe '#user_namespace?' do
subject { namespace.user_namespace? }