Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git_http_routing_spec.rb « routing « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e5216d99eb961090b1424236d3ef52d74a02c822 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

require 'spec_helper'

RSpec.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