debian-mirror-gitlab/spec/routing/git_http_routing_spec.rb

25 lines
760 B
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe 'git_http routing' do
2019-10-12 21:52:04 +05:30
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