summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorEric Eastwood <contact@ericeastwood.com>2017-11-03 04:43:55 -0500
committerEric Eastwood <contact@ericeastwood.com>2017-11-03 04:43:55 -0500
commit694cfeb7b7288d7d27eca30f808fba421c1f1719 (patch)
tree603a4e325ef69ecb87f0db7ea39398130c2e3181 /spec/models
parent600d5f4fba4f73ef438db651d20da92080e5b3b0 (diff)
parentf580e49713c611094029424e779f25bd9807c7cf (diff)
downloadgitlab-ce-694cfeb7b7288d7d27eca30f808fba421c1f1719.tar.gz
Merge branch 'master' into refactor-clusters
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/environment_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb
index e1be23541e8..f75de0a0d88 100644
--- a/spec/models/environment_spec.rb
+++ b/spec/models/environment_spec.rb
@@ -547,6 +547,15 @@ describe Environment do
expect(environment.slug).to eq(original_slug)
end
+
+ it "regenerates the slug if nil" do
+ environment = build(:environment, slug: nil)
+
+ new_slug = environment.slug
+
+ expect(new_slug).not_to be_nil
+ expect(environment.slug).to eq(new_slug)
+ end
end
describe '#generate_slug' do
@@ -583,6 +592,12 @@ describe Environment do
it 'returns a path that uses the slug and does not have spaces' do
expect(environment.ref_path).to start_with('refs/environments/staging-review-1-')
end
+
+ it "doesn't change when the slug is nil initially" do
+ environment.slug = nil
+
+ expect(environment.ref_path).to eq(environment.ref_path)
+ end
end
describe '#external_url_for' do