summaryrefslogtreecommitdiff
path: root/spec/models/environment_spec.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-09-08 06:45:20 +0000
committerJarka Kadlecova <jarka@gitlab.com>2017-09-08 10:07:06 +0200
commitd1002d1e03be6ceedde6dc152b2d02bc816e47d1 (patch)
treeaa3a4fd5ebb2bc93fcad8bf6be696bb84a2afdf7 /spec/models/environment_spec.rb
parentb39d0c318921bae2e3a11df9ee6828291dad9864 (diff)
downloadgitlab-ce-d1002d1e03be6ceedde6dc152b2d02bc816e47d1.tar.gz
Merge branch 'rs-pick-security-into-master' into 'master'
Update master with 9.5.4 security patches See merge request !14131
Diffstat (limited to 'spec/models/environment_spec.rb')
-rw-r--r--spec/models/environment_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb
index ea8512a5eae..25e5d155894 100644
--- a/spec/models/environment_spec.rb
+++ b/spec/models/environment_spec.rb
@@ -54,6 +54,28 @@ describe Environment do
end
end
+ describe '#folder_name' do
+ context 'when it is inside a folder' do
+ subject(:environment) do
+ create(:environment, name: 'staging/review-1')
+ end
+
+ it 'returns a top-level folder name' do
+ expect(environment.folder_name).to eq 'staging'
+ end
+ end
+
+ context 'when the environment if a top-level item itself' do
+ subject(:environment) do
+ create(:environment, name: 'production')
+ end
+
+ it 'returns an environment name' do
+ expect(environment.folder_name).to eq 'production'
+ end
+ end
+ end
+
describe '#nullify_external_url' do
it 'replaces a blank url with nil' do
env = build(:environment, external_url: "")