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:
authorElliot <ewiltshire@perforce.com>2016-08-11 14:15:46 +0300
committerRémy Coutable <remy@rymai.me>2016-08-11 14:21:59 +0300
commit68cea38e94886e69099a3faa0d1e2fbde2e71899 (patch)
tree417de4d96338cc4eff64607376992326dfabc64e /spec/lib/extracts_path_spec.rb
parent3a46eac1ef903c027c244d31369329f45c636914 (diff)
Fix front-end for branches that happen to contain urlencoding escape characters (e.g. %)
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/lib/extracts_path_spec.rb')
-rw-r--r--spec/lib/extracts_path_spec.rb19
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