From 3bff85a4f659438edbbc486a0b3c32ff589ab299 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Mon, 23 Oct 2017 03:57:51 +0300 Subject: Fix the writing of invalid environment refs Environment names that contained a space would cause an error in GitLab 10.1 because a new guard clause was introduced in Repository#write_ref to prevent such references from existing. Use the slug instead to ensure that the name is valid. Closes #39182 --- spec/models/environment_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'spec') diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb index 25e5d155894..e1be23541e8 100644 --- a/spec/models/environment_spec.rb +++ b/spec/models/environment_spec.rb @@ -575,6 +575,16 @@ describe Environment do end end + describe '#ref_path' do + subject(:environment) do + create(:environment, name: 'staging / review-1') + end + + 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 + end + describe '#external_url_for' do let(:source_path) { 'source/file.html' } let(:sha) { RepoHelpers.sample_commit.id } -- cgit v1.2.1