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:
authorVladimir Shushlin <vshushlin@gitlab.com>2019-02-26 22:13:09 +0300
committerStan Hu <stanhu@gmail.com>2019-02-26 22:13:09 +0300
commit25c10abb80799e24e616e2bb8c0081096b201c29 (patch)
treec602b75234cd3abdb50cb62a46d539bdb6cfa5b8 /spec/models/environment_spec.rb
parent9812006568061f0afd8dfb146920e526877d4d9b (diff)
Add name_without_type to environments.json
It's needed to show shorter names in environments "folders"
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 2d554326f05..ab1b306e597 100644
--- a/spec/models/environment_spec.rb
+++ b/spec/models/environment_spec.rb
@@ -164,6 +164,28 @@ describe Environment do
end
end
+ describe '#name_without_type' do
+ context 'when it is inside a folder' do
+ subject(:environment) do
+ create(:environment, name: 'staging/review-1')
+ end
+
+ it 'returns name without folder' do
+ expect(environment.name_without_type).to eq 'review-1'
+ end
+ end
+
+ context 'when the environment if a top-level item itself' do
+ subject(:environment) do
+ create(:environment, name: 'production')
+ end
+
+ it 'returns full name' do
+ expect(environment.name_without_type).to eq 'production'
+ end
+ end
+ end
+
describe '#nullify_external_url' do
it 'replaces a blank url with nil' do
env = build(:environment, external_url: "")