summaryrefslogtreecommitdiff
path: root/spec/routing/project_routing_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-02-01 09:02:36 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-02-01 09:02:58 +0000
commit23330db102f66781cc9a22cd006433cfcbd13863 (patch)
tree7c1630c6373a1c4d156eeb7f8bc4010c9a280d11 /spec/routing/project_routing_spec.rb
parent8d628223c41aabc9d42af95cce1193becffa1b0f (diff)
downloadgitlab-ce-23330db102f66781cc9a22cd006433cfcbd13863.tar.gz
Add latest changes from gitlab-org/security/gitlab@13-8-stable-ee
Diffstat (limited to 'spec/routing/project_routing_spec.rb')
-rw-r--r--spec/routing/project_routing_spec.rb69
1 files changed, 69 insertions, 0 deletions
diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb
index 29e5c1b4bae..f7ed8d7d5dc 100644
--- a/spec/routing/project_routing_spec.rb
+++ b/spec/routing/project_routing_spec.rb
@@ -876,4 +876,73 @@ RSpec.describe 'project routing' do
)
end
end
+
+ context 'with a non-existent project' do
+ it 'routes to 404 with get request' do
+ expect(get: "/gitlab/not_exist").to route_to(
+ 'application#route_not_found',
+ unmatched_route: 'gitlab/not_exist'
+ )
+ end
+
+ it 'routes to 404 with delete request' do
+ expect(delete: "/gitlab/not_exist").to route_to(
+ 'application#route_not_found',
+ namespace_id: 'gitlab',
+ project_id: 'not_exist'
+ )
+ end
+
+ it 'routes to 404 with post request' do
+ expect(post: "/gitlab/not_exist").to route_to(
+ 'application#route_not_found',
+ namespace_id: 'gitlab',
+ project_id: 'not_exist'
+ )
+ end
+
+ it 'routes to 404 with put request' do
+ expect(put: "/gitlab/not_exist").to route_to(
+ 'application#route_not_found',
+ namespace_id: 'gitlab',
+ project_id: 'not_exist'
+ )
+ end
+
+ context 'with route to some action' do
+ it 'routes to 404 with get request to' do
+ expect(get: "/gitlab/not_exist/some_action").to route_to(
+ 'application#route_not_found',
+ unmatched_route: 'gitlab/not_exist/some_action'
+ )
+ end
+
+ it 'routes to 404 with delete request' do
+ expect(delete: "/gitlab/not_exist/some_action").to route_to(
+ 'application#route_not_found',
+ namespace_id: 'gitlab',
+ project_id: 'not_exist',
+ all: 'some_action'
+ )
+ end
+
+ it 'routes to 404 with post request' do
+ expect(post: "/gitlab/not_exist/some_action").to route_to(
+ 'application#route_not_found',
+ namespace_id: 'gitlab',
+ project_id: 'not_exist',
+ all: 'some_action'
+ )
+ end
+
+ it 'routes to 404 with put request' do
+ expect(put: "/gitlab/not_exist/some_action").to route_to(
+ 'application#route_not_found',
+ namespace_id: 'gitlab',
+ project_id: 'not_exist',
+ all: 'some_action'
+ )
+ end
+ end
+ end
end