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:
authorFilipa Lacerda <filipa@gitlab.com>2018-07-04 20:10:37 +0300
committerFilipa Lacerda <filipa@gitlab.com>2018-07-04 20:10:37 +0300
commit116955c4533497e68abbddbace2eae0a07c98569 (patch)
tree8a3d10e7f6ac265d31da47ffe0c69f09c65c2f6b /spec/models/project_spec.rb
parentc0e50fdfc296777871f3cc2d417252f599f5fcfb (diff)
parent01248876d2a74e3a5eee5a55908c687da3b9600e (diff)
Merge branch '45739-add-metrics-to-operations-tab' into 'master'
Resolve "Add Metrics to Operations Tab" Closes #45739 See merge request gitlab-org/gitlab-ce!20025
Diffstat (limited to 'spec/models/project_spec.rb')
-rw-r--r--spec/models/project_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index abdc65336ca..c3aa6cd6fed 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -2292,6 +2292,28 @@ describe Project do
end
end
+ describe '#default_environment' do
+ let(:project) { create(:project) }
+
+ it 'returns production environment when it exists' do
+ production = create(:environment, name: "production", project: project)
+ create(:environment, name: 'staging', project: project)
+
+ expect(project.default_environment).to eq(production)
+ end
+
+ it 'returns first environment when no production environment exists' do
+ create(:environment, name: 'staging', project: project)
+ create(:environment, name: 'foo', project: project)
+
+ expect(project.default_environment).to eq(project.environments.first)
+ end
+
+ it 'returns nil when no available environment exists' do
+ expect(project.default_environment).to be_nil
+ end
+ end
+
describe '#secret_variables_for' do
let(:project) { create(:project) }