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:
authorThong Kuah <tkuah@gitlab.com>2018-09-06 12:21:00 +0300
committerThong Kuah <tkuah@gitlab.com>2018-09-06 12:22:26 +0300
commit7d490e6a089296ba7db2678a00e4f83c3b11aa63 (patch)
tree7adb10c89e23cd9922203b9fac5173228bf070b5
parent0152cf2160b2da23f569a453f4afc93b7292f846 (diff)
Add missing specs for Project#auto_devops_variables
-rw-r--r--spec/models/project_spec.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 0f3d8902611..7fe4965a4f0 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -2474,6 +2474,47 @@ describe Project do
end
end
+ describe '#auto_devops_variables' do
+ set(:project) { create(:project) }
+
+ subject { project.auto_devops_variables }
+
+ it 'returns an empty array' do
+ is_expected.to eq []
+ end
+
+ context 'when enabled in instance settings' do
+ before do
+ stub_application_setting(auto_devops_enabled: true)
+ end
+
+ it 'returns an empty variables collection' do
+ expect(subject.to_hash).to eq({})
+ end
+ end
+
+ context 'when explicitly enabled' do
+ let(:deploy_strategy) { 'continuous' }
+
+ before do
+ create(:project_auto_devops, project: project, deploy_strategy: deploy_strategy)
+ end
+
+ it 'returns an empty variables collection' do
+ expect(subject.to_hash).to eq({})
+ end
+
+ context 'when deploy_strategy is manual' do
+ let(:deploy_strategy) { 'manual' }
+
+ it 'has CI variables for manual strategy' do
+ expect(subject.map { |var| var[:key] })
+ .to include("STAGING_ENABLED", "INCREMENTAL_ROLLOUT_ENABLED")
+ end
+ end
+ end
+ end
+
describe '#secret_variables_for' do
let(:project) { create(:project) }