diff options
author | Kieran Andrews <hiddentiger@gmail.com> | 2019-04-03 14:38:46 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-04-03 14:38:46 +0300 |
commit | ebbcc17f243337581536bd1f34dc7d6b5712ebb9 (patch) | |
tree | 40be20a716ff5501982489a6dd48a7de0c0a42a3 /spec/helpers/blob_helper_spec.rb | |
parent | 7700e0298802857495bd3d0e7601a5d47a7b3335 (diff) |
Merge branch 'feature/webide_escaping' of gitlab.com:hiddentiger/gitlab-ce into feature/webide_escaping
Diffstat (limited to 'spec/helpers/blob_helper_spec.rb')
-rw-r--r-- | spec/helpers/blob_helper_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/helpers/blob_helper_spec.rb b/spec/helpers/blob_helper_spec.rb index 2bc3933809f..6808ed86c9a 100644 --- a/spec/helpers/blob_helper_spec.rb +++ b/spec/helpers/blob_helper_spec.rb @@ -230,5 +230,18 @@ describe BlobHelper do expect(helper.ide_edit_path(project, "master", "")).to eq("/gitlab/-/ide/project/#{project.namespace.path}/#{project.path}/edit/master") end + + it 'escapes special characters' do + Rails.application.routes.default_url_options[:script_name] = nil + + expect(helper.ide_edit_path(project, "testing/#hashes", "readme.md#test")).to eq("/-/ide/project/#{project.namespace.path}/#{project.path}/edit/testing/#hashes/-/readme.md%23test") + expect(helper.ide_edit_path(project, "testing/#hashes", "src#/readme.md#test")).to eq("/-/ide/project/#{project.namespace.path}/#{project.path}/edit/testing/#hashes/-/src%23/readme.md%23test") + end + + it 'does not escape "/" character' do + Rails.application.routes.default_url_options[:script_name] = nil + + expect(helper.ide_edit_path(project, "testing/slashes", "readme.md/")).to eq("/-/ide/project/#{project.namespace.path}/#{project.path}/edit/testing/slashes/-/readme.md/") + end end end |