diff options
author | Stan Hu <stanhu@gmail.com> | 2019-07-26 21:01:41 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-07-26 21:01:41 +0000 |
commit | 2219b140b6873b893a3cac2cae195b929a20f5aa (patch) | |
tree | f69b0064f5aa05e5225c6920709837873ee62b5f /spec | |
parent | 195c85eb3a1fb9f904d2ade69a23f5d3c884f502 (diff) | |
parent | 634a03bf608eaf86ecf14b4f44fa30e62905ac6b (diff) | |
download | gitlab-ce-2219b140b6873b893a3cac2cae195b929a20f5aa.tar.gz |
Merge branch '19186-redirect-wiki-git-route-to-wiki' into 'master'
Redirect project.wiki.git to project wiki home
See merge request gitlab-org/gitlab-ce!31085
Diffstat (limited to 'spec')
-rw-r--r-- | spec/routing/git_http_routing_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/routing/git_http_routing_spec.rb b/spec/routing/git_http_routing_spec.rb new file mode 100644 index 00000000000..af14e5f81cb --- /dev/null +++ b/spec/routing/git_http_routing_spec.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'git_http routing' do + include RSpec::Rails::RequestExampleGroup + + describe 'wiki.git routing', 'routing' do + let(:wiki_path) { '/gitlab/gitlabhq/wikis' } + + it 'redirects namespace/project.wiki.git to the project wiki' do + expect(get('/gitlab/gitlabhq.wiki.git')).to redirect_to(wiki_path) + end + + it 'preserves query parameters' do + expect(get('/gitlab/gitlabhq.wiki.git?foo=bar&baz=qux')).to redirect_to("#{wiki_path}?foo=bar&baz=qux") + end + + it 'only redirects when the format is .git' do + expect(get('/gitlab/gitlabhq.wiki')).not_to redirect_to(wiki_path) + expect(get('/gitlab/gitlabhq.wiki.json')).not_to redirect_to(wiki_path) + end + end +end |