diff options
author | Elliot <ewiltshire@perforce.com> | 2016-08-11 13:15:46 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-08-11 13:21:59 +0200 |
commit | 68cea38e94886e69099a3faa0d1e2fbde2e71899 (patch) | |
tree | 417de4d96338cc4eff64607376992326dfabc64e /spec | |
parent | 3a46eac1ef903c027c244d31369329f45c636914 (diff) | |
download | gitlab-ce-68cea38e94886e69099a3faa0d1e2fbde2e71899.tar.gz |
Fix front-end for branches that happen to contain urlencoding escape characters (e.g. %)10772-fix-urlencoded-branchname
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/extracts_path_spec.rb | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/spec/lib/extracts_path_spec.rb b/spec/lib/extracts_path_spec.rb index b12a7b98d4d..36c77206a3f 100644 --- a/spec/lib/extracts_path_spec.rb +++ b/spec/lib/extracts_path_spec.rb @@ -30,15 +30,28 @@ describe ExtractsPath, lib: true do expect(@logs_path).to eq("/#{@project.path_with_namespace}/refs/#{ref}/logs_tree/files/ruby/popen.rb") end - context 'escaped sequences in ref' do - let(:ref) { "improve%2Fawesome" } + context 'escaped slash character in ref' do + let(:ref) { 'improve%2Fawesome' } - it "id has no escape sequences" do + it 'has no escape sequences in @ref or @logs_path' do assign_ref_vars + expect(@ref).to eq('improve/awesome') expect(@logs_path).to eq("/#{@project.path_with_namespace}/refs/#{ref}/logs_tree/files/ruby/popen.rb") end end + + context 'ref contains %20' do + let(:ref) { 'foo%20bar' } + + it 'is not converted to a space in @id' do + @project.repository.add_branch(@project.owner, 'foo%20bar', 'master') + + assign_ref_vars + + expect(@id).to start_with('foo%20bar/') + end + end end describe '#extract_ref' do |