Commit d85bbf0d authored by Valery Sizov's avatar Valery Sizov

Specs for new group routing

parent 9ac31d3b
...@@ -81,7 +81,7 @@ constraints(GroupUrlConstrainer.new) do ...@@ -81,7 +81,7 @@ constraints(GroupUrlConstrainer.new) do
## EE-specific ## EE-specific
get :boards, to: redirect('/groups/%{group_id}/-/boards') get :boards, to: redirect('/groups/%{group_id}/-/boards')
end end
scope(path: '*id', scope(path: '*id',
as: :group, as: :group,
......
require 'spec_helper'
describe 'Deprecated boards paths' do
it 'redirects to boards page' do
group = create :group, name: 'gitlabhq'
get('/groups/gitlabhq/boards')
expect(response).to redirect_to(group_boards_path(group))
end
end
require 'spec_helper'
describe 'Group routing' do
describe 'subgroup "boards"' do
it 'shows group show page' do
allow(Group).to receive(:find_by_full_path).with('gitlabhq/boards', any_args).and_return(true)
expect(get('/groups/gitlabhq/boards')).to route_to('groups#show', id: 'gitlabhq/boards')
end
it 'shows boards index page' do
allow(Group).to receive(:find_by_full_path).with('gitlabhq', any_args).and_return(true)
expect(get('/groups/gitlabhq/-/boards')).to route_to('groups/boards#index', group_id: 'gitlabhq')
end
end
end
...@@ -285,17 +285,15 @@ end ...@@ -285,17 +285,15 @@ end
describe "Groups", "routing" do describe "Groups", "routing" do
let(:name) { 'complex.group-namegit' } let(:name) { 'complex.group-namegit' }
let!(:group) { create(:group, name: name) }
before do
allow_any_instance_of(GroupUrlConstrainer).to receive(:matches?).and_return(true)
end
it "to #show" do it "to #show" do
expect(get("/groups/#{name}")).to route_to('groups#show', id: name) expect(get("/groups/#{name}")).to route_to('groups#show', id: name)
end end
it "also supports nested groups" do it "also supports nested groups" do
expect(get("/#{name}/#{name}")).to route_to('groups#show', id: "#{name}/#{name}") nested_group = create(:group, parent: group)
expect(get("/#{name}/#{nested_group.name}")).to route_to('groups#show', id: "#{name}/#{nested_group.name}")
end end
it "also display group#show on the short path" do it "also display group#show on the short path" do
...@@ -313,10 +311,6 @@ describe "Groups", "routing" do ...@@ -313,10 +311,6 @@ describe "Groups", "routing" do
it "to #members" do it "to #members" do
expect(get("/groups/#{name}/group_members")).to route_to('groups/group_members#index', group_id: name) expect(get("/groups/#{name}/group_members")).to route_to('groups/group_members#index', group_id: name)
end end
it "also display group#show with slash in the path" do
expect(get('/group/subgroup')).to route_to('groups#show', id: 'group/subgroup')
end
end end
describe HealthCheckController, 'routing' do describe HealthCheckController, 'routing' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment