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

79 lines
2.4 KiB
Ruby
Raw Normal View History

2019-12-26 22:10:19 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.shared_examples 'groups routing' do
let(:group_path) { 'projects.abc123' }
2018-03-17 18:26:18 +05:30
let!(:group) { create(:group, path: group_path) }
it "to #show" do
expect(get("/groups/#{group_path}")).to route_to('groups#show', id: group_path)
end
it "also supports nested groups" do
nested_group = create(:group, parent: group)
expect(get("/#{group_path}/#{nested_group.path}")).to route_to('groups#show', id: "#{group_path}/#{nested_group.path}")
end
it "also display group#show on the short path" do
expect(get("/#{group_path}")).to route_to('groups#show', id: group_path)
end
2019-07-07 11:18:12 +05:30
it "to #details" do
expect(get("/groups/#{group_path}/-/details")).to route_to('groups#details', id: group_path)
end
2018-03-17 18:26:18 +05:30
it "to #activity" do
expect(get("/groups/#{group_path}/-/activity")).to route_to('groups#activity', id: group_path)
end
it "to #issues" do
expect(get("/groups/#{group_path}/-/issues")).to route_to('groups#issues', id: group_path)
end
it "to #members" do
expect(get("/groups/#{group_path}/-/group_members")).to route_to('groups/group_members#index', group_id: group_path)
end
it "to #labels" do
expect(get("/groups/#{group_path}/-/labels")).to route_to('groups/labels#index', group_id: group_path)
end
it "to #milestones" do
expect(get("/groups/#{group_path}/-/milestones")).to route_to('groups/milestones#index', group_id: group_path)
end
2019-09-30 21:07:59 +05:30
it 'routes to the avatars controller' do
expect(delete("/groups/#{group_path}/-/avatar"))
.to route_to(group_id: group_path,
controller: 'groups/avatars',
action: 'destroy')
end
2019-07-31 22:56:46 +05:30
2019-09-30 21:07:59 +05:30
it 'routes to the boards controller' do
allow(Group).to receive(:find_by_full_path).with('gitlabhq', any_args).and_return(true)
2019-07-31 22:56:46 +05:30
2019-09-30 21:07:59 +05:30
expect(get('/groups/gitlabhq/-/boards')).to route_to('groups/boards#index', group_id: 'gitlabhq')
2018-03-17 18:26:18 +05:30
end
end
2020-07-28 23:09:34 +05:30
RSpec.describe "Groups", "routing" do
context 'complex group path with dot' do
include_examples 'groups routing' do
let(:group_path) { 'complex.group-namegit' }
end
end
context 'group path starting with help' do
include_examples 'groups routing' do
let(:group_path) { 'help.abc123' }
end
end
context 'group path starting with projects' do
include_examples 'groups routing' do
let(:group_path) { 'projects.abc123' }
end
end
end