summaryrefslogtreecommitdiff
path: root/spec/routing/group_routing_spec.rb
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-10-27 11:29:51 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2017-11-07 19:52:09 +0100
commit58d1d6a5c7e0a45c9aa8a9d4d1be24dbdce5a08a (patch)
tree4f78e39630276f4dc734964f44dc1d7869282955 /spec/routing/group_routing_spec.rb
parent5dde0536c323d14fef2327a8d553b5f8a8a7b2d0 (diff)
downloadgitlab-ce-58d1d6a5c7e0a45c9aa8a9d4d1be24dbdce5a08a.tar.gz
Free up some group reserved words
Diffstat (limited to 'spec/routing/group_routing_spec.rb')
-rw-r--r--spec/routing/group_routing_spec.rb73
1 files changed, 56 insertions, 17 deletions
diff --git a/spec/routing/group_routing_spec.rb b/spec/routing/group_routing_spec.rb
index b3e55f5e3c9..3e56d34bc9d 100644
--- a/spec/routing/group_routing_spec.rb
+++ b/spec/routing/group_routing_spec.rb
@@ -18,37 +18,36 @@ describe "Groups", "routing" do
end
it "to #activity" do
- expect(get("/groups/#{group_path}/activity")).to route_to('groups#activity', id: group_path)
+ 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)
+ 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
- describe 'legacy redirection' do
- shared_examples 'canonical groups route' do |path|
- it "#{path} routes to the correct controller" do
- expect(get("/groups/#{group_path}/-/#{path}"))
- .to route_to(group_id: group_path,
- controller: "groups/#{path}",
- action: 'index')
- end
+ it "to #labels" do
+ expect(get("/groups/#{group_path}/-/labels")).to route_to('groups/labels#index', group_id: group_path)
+ end
- it_behaves_like 'redirecting a legacy path', "/groups/complex.group-namegit/#{path}", "/groups/complex.group-namegit/-/#{path}/" do
- let(:resource) { create(:group, parent: group, path: path) }
- end
- end
+ it "to #milestones" do
+ expect(get("/groups/#{group_path}/-/milestones")).to route_to('groups/milestones#index', group_id: group_path)
+ end
+ describe 'legacy redirection' do
describe 'labels' do
- it_behaves_like 'canonical groups route', 'labels'
+ it_behaves_like 'redirecting a legacy path', "/groups/complex.group-namegit/labels", "/groups/complex.group-namegit/-/labels/" do
+ let(:resource) { create(:group, parent: group, path: 'labels') }
+ end
end
describe 'group_members' do
- it_behaves_like 'canonical groups route', 'group_members'
+ it_behaves_like 'redirecting a legacy path', "/groups/complex.group-namegit/group_members", "/groups/complex.group-namegit/-/group_members/" do
+ let(:resource) { create(:group, parent: group, path: 'group_members') }
+ end
end
describe 'avatar' do
@@ -61,7 +60,9 @@ describe "Groups", "routing" do
end
describe 'milestones' do
- it_behaves_like 'canonical groups route', 'milestones'
+ it_behaves_like 'redirecting a legacy path', "/groups/complex.group-namegit/milestones", "/groups/complex.group-namegit/-/milestones/" do
+ let(:resource) { create(:group, parent: group, path: 'milestones') }
+ end
context 'nested routes' do
include RSpec::Rails::RequestExampleGroup
@@ -74,5 +75,43 @@ describe "Groups", "routing" do
end
end
end
+
+ describe 'edit' do
+ it_behaves_like 'redirecting a legacy path', "/groups/complex.group-namegit/edit", "/groups/complex.group-namegit/-/edit/" do
+ let(:resource) do
+ pending('still rejected because of the wildcard reserved word')
+ create(:group, parent: group, path: 'edit')
+ end
+ end
+ end
+
+ describe 'issues' do
+ it_behaves_like 'redirecting a legacy path', "/groups/complex.group-namegit/issues", "/groups/complex.group-namegit/-/issues/" do
+ let(:resource) { create(:group, parent: group, path: 'issues') }
+ end
+ end
+
+ describe 'merge_requests' do
+ it_behaves_like 'redirecting a legacy path', "/groups/complex.group-namegit/merge_requests", "/groups/complex.group-namegit/-/merge_requests/" do
+ let(:resource) { create(:group, parent: group, path: 'merge_requests') }
+ end
+ end
+
+ describe 'projects' do
+ it_behaves_like 'redirecting a legacy path', "/groups/complex.group-namegit/projects", "/groups/complex.group-namegit/-/projects/" do
+ let(:resource) { create(:group, parent: group, path: 'projects') }
+ end
+ end
+
+ describe 'activity' do
+ it_behaves_like 'redirecting a legacy path', "/groups/complex.group-namegit/activity", "/groups/complex.group-namegit/-/activity/" do
+ let(:resource) { create(:group, parent: group, path: 'activity') }
+ end
+
+ it_behaves_like 'redirecting a legacy path', "/groups/activity/activity", "/groups/activity/-/activity/" do
+ let!(:parent) { create(:group, path: 'activity') }
+ let(:resource) { create(:group, parent: parent, path: 'activity') }
+ end
+ end
end
end