summaryrefslogtreecommitdiff
path: root/spec/controllers/concerns
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2018-06-18 11:44:55 +0100
committerFilipa Lacerda <filipa@gitlab.com>2018-06-18 11:44:55 +0100
commit67608c7be5b3997231789503fa0bc599cb790f7a (patch)
treef04ff6c6b42bf35bb058e690c102788237a75fbc /spec/controllers/concerns
parent1907738f02f42b02fa86a02aa8af747492698d66 (diff)
parenta170c587a0ee2f303908c70a942ef3f163e2ddb7 (diff)
downloadgitlab-ce-fl-update-registry-code.tar.gz
[ci skip] Merge branch 'master' into fl-update-registry-codefl-update-registry-code
* master: (68 commits) Render calendar feed inline when accessed from GitLab Make Gitaly wiki RPC's mandatory Remove the ci_job_request_with_tags_matcher Optimised paused runners to not re-query every 3s [Rails5] Set request.format for artifacts_controller [Rails5] Fix sessions_controller_spec Rails5 update Gemfile.rails5.lock [Rails5] Fix pipeline_schedules_controller_spec Fix milestones disappearing when changed on MR Harmonize theme preferences previews Resolve "Wiki git clone holder and dropdown is broken" Resolve "Update link in GitLab cluster setup form to say "see pricing"" Resolve "Misalignment in rows on comparison page" Resolve "Stop horizontal scrolling when clicking on board issue" Enable no-multi-assignment in JS files Fix ci mini graph dropdown alignment and positioning Remove additional border from the create project page Fix alert colors Enable display static for ci job dropdowns so that they dont move when window resizes Remove pointer events in favor of boundary viewport ...
Diffstat (limited to 'spec/controllers/concerns')
-rw-r--r--spec/controllers/concerns/internal_redirect_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/controllers/concerns/internal_redirect_spec.rb b/spec/controllers/concerns/internal_redirect_spec.rb
index a0ee13b2352..7e23b56356e 100644
--- a/spec/controllers/concerns/internal_redirect_spec.rb
+++ b/spec/controllers/concerns/internal_redirect_spec.rb
@@ -54,6 +54,31 @@ describe InternalRedirect do
end
end
+ describe '#sanitize_redirect' do
+ let(:valid_path) { '/hello/world?hello=world' }
+ let(:valid_url) { "http://test.host#{valid_path}" }
+
+ it 'returns `nil` for invalid paths' do
+ invalid_path = '//not/valid'
+
+ expect(controller.sanitize_redirect(invalid_path)).to eq nil
+ end
+
+ it 'returns `nil` for invalid urls' do
+ input = 'http://test.host:3000/invalid'
+
+ expect(controller.sanitize_redirect(input)).to eq nil
+ end
+
+ it 'returns input for valid paths' do
+ expect(controller.sanitize_redirect(valid_path)).to eq valid_path
+ end
+
+ it 'returns path for valid urls' do
+ expect(controller.sanitize_redirect(valid_url)).to eq valid_path
+ end
+ end
+
describe '#host_allowed?' do
it 'allows uris with the same host and port' do
expect(controller.host_allowed?(URI('http://test.host/test'))).to be(true)