2012-09-16 12:42:52 -04:00
require 'spec_helper'
# Shared examples for a resource inside a Project
#
# By default it tests all the default REST actions: index, create, new, edit,
# show, update, and destroy. You can remove actions by customizing the
# `actions` variable.
#
# It also expects a `controller` variable to be available which defines both
# the path to the resource as well as the controller name.
#
# Examples
#
# # Default behavior
2015-01-19 15:37:20 -05:00
# it_behaves_like 'RESTful project resources' do
2012-09-16 12:42:52 -04:00
# let(:controller) { 'issues' }
# end
#
# # Customizing actions
2015-01-19 15:37:20 -05:00
# it_behaves_like 'RESTful project resources' do
2012-09-16 12:42:52 -04:00
# let(:actions) { [:index] }
# let(:controller) { 'issues' }
# end
2015-01-19 15:37:20 -05:00
shared_examples 'RESTful project resources' do
2012-09-16 12:42:52 -04:00
let ( :actions ) { [ :index , :create , :new , :edit , :show , :update , :destroy ] }
2015-01-19 15:37:20 -05:00
it 'to #index' do
2015-01-24 13:02:58 -05:00
expect ( get ( " /gitlab/gitlabhq/ #{ controller } " ) ) . to route_to ( " projects/ #{ controller } # index " , namespace_id : 'gitlab' , project_id : 'gitlabhq' ) if actions . include? ( :index )
2012-09-16 12:42:52 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #create' do
2015-01-24 13:02:58 -05:00
expect ( post ( " /gitlab/gitlabhq/ #{ controller } " ) ) . to route_to ( " projects/ #{ controller } # create " , namespace_id : 'gitlab' , project_id : 'gitlabhq' ) if actions . include? ( :create )
2012-09-16 12:42:52 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #new' do
2015-01-24 13:02:58 -05:00
expect ( get ( " /gitlab/gitlabhq/ #{ controller } /new " ) ) . to route_to ( " projects/ #{ controller } # new " , namespace_id : 'gitlab' , project_id : 'gitlabhq' ) if actions . include? ( :new )
2012-09-16 12:42:52 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #edit' do
2015-01-24 13:02:58 -05:00
expect ( get ( " /gitlab/gitlabhq/ #{ controller } /1/edit " ) ) . to route_to ( " projects/ #{ controller } # edit " , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : '1' ) if actions . include? ( :edit )
2012-09-16 12:42:52 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #show' do
2015-01-24 13:02:58 -05:00
expect ( get ( " /gitlab/gitlabhq/ #{ controller } /1 " ) ) . to route_to ( " projects/ #{ controller } # show " , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : '1' ) if actions . include? ( :show )
2012-09-16 12:42:52 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #update' do
2015-01-24 13:02:58 -05:00
expect ( put ( " /gitlab/gitlabhq/ #{ controller } /1 " ) ) . to route_to ( " projects/ #{ controller } # update " , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : '1' ) if actions . include? ( :update )
2012-09-16 12:42:52 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #destroy' do
2015-01-24 13:02:58 -05:00
expect ( delete ( " /gitlab/gitlabhq/ #{ controller } /1 " ) ) . to route_to ( " projects/ #{ controller } # destroy " , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : '1' ) if actions . include? ( :destroy )
2012-09-16 12:42:52 -04:00
end
end
2014-10-15 03:21:21 -04:00
# projects POST /projects(.:format) projects#create
# new_project GET /projects/new(.:format) projects#new
# files_project GET /:id/files(.:format) projects#files
# edit_project GET /:id/edit(.:format) projects#edit
# project GET /:id(.:format) projects#show
# PUT /:id(.:format) projects#update
# DELETE /:id(.:format) projects#destroy
2015-02-06 05:21:42 -05:00
# markdown_preview_project POST /:id/markdown_preview(.:format) projects#markdown_preview
2015-01-19 15:37:20 -05:00
describe ProjectsController , 'routing' do
it 'to #create' do
2015-02-12 13:17:35 -05:00
expect ( post ( '/projects' ) ) . to route_to ( 'projects#create' )
2012-09-16 12:42:52 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #new' do
2015-02-12 13:17:35 -05:00
expect ( get ( '/projects/new' ) ) . to route_to ( 'projects#new' )
2012-09-16 12:42:52 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #edit' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/edit' ) ) . to route_to ( 'projects#edit' , namespace_id : 'gitlab' , id : 'gitlabhq' )
2012-09-16 12:42:52 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #autocomplete_sources' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/autocomplete_sources' ) ) . to route_to ( 'projects#autocomplete_sources' , namespace_id : 'gitlab' , id : 'gitlabhq' )
2013-05-03 11:39:18 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #show' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq' ) ) . to route_to ( 'projects#show' , namespace_id : 'gitlab' , id : 'gitlabhq' )
2012-09-16 12:42:52 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #update' do
2015-01-24 13:02:58 -05:00
expect ( put ( '/gitlab/gitlabhq' ) ) . to route_to ( 'projects#update' , namespace_id : 'gitlab' , id : 'gitlabhq' )
2012-09-16 12:42:52 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #destroy' do
2015-01-24 13:02:58 -05:00
expect ( delete ( '/gitlab/gitlabhq' ) ) . to route_to ( 'projects#destroy' , namespace_id : 'gitlab' , id : 'gitlabhq' )
2012-09-16 12:42:52 -04:00
end
2014-10-15 03:21:21 -04:00
it 'to #markdown_preview' do
2015-02-12 13:17:35 -05:00
expect ( post ( '/gitlab/gitlabhq/markdown_preview' ) ) . to (
2015-01-24 13:02:58 -05:00
route_to ( 'projects#markdown_preview' , namespace_id : 'gitlab' , id : 'gitlabhq' )
2014-10-15 03:21:21 -04:00
)
end
2012-09-16 12:42:52 -04:00
end
2013-06-23 13:25:06 -04:00
# pages_project_wikis GET /:project_id/wikis/pages(.:format) projects/wikis#pages
# history_project_wiki GET /:project_id/wikis/:id/history(.:format) projects/wikis#history
# project_wikis POST /:project_id/wikis(.:format) projects/wikis#create
# edit_project_wiki GET /:project_id/wikis/:id/edit(.:format) projects/wikis#edit
# project_wiki GET /:project_id/wikis/:id(.:format) projects/wikis#show
# DELETE /:project_id/wikis/:id(.:format) projects/wikis#destroy
2015-01-19 15:37:20 -05:00
describe Projects :: WikisController , 'routing' do
it 'to #pages' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/wikis/pages' ) ) . to route_to ( 'projects/wikis#pages' , namespace_id : 'gitlab' , project_id : 'gitlabhq' )
2012-09-16 12:42:52 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #history' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/wikis/1/history' ) ) . to route_to ( 'projects/wikis#history' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : '1' )
2012-09-16 12:42:52 -04:00
end
2015-01-19 15:37:20 -05:00
it_behaves_like 'RESTful project resources' do
2012-09-16 12:42:52 -04:00
let ( :actions ) { [ :create , :edit , :show , :destroy ] }
let ( :controller ) { 'wikis' }
end
end
2013-06-23 13:25:06 -04:00
# branches_project_repository GET /:project_id/repository/branches(.:format) projects/repositories#branches
# tags_project_repository GET /:project_id/repository/tags(.:format) projects/repositories#tags
# archive_project_repository GET /:project_id/repository/archive(.:format) projects/repositories#archive
# edit_project_repository GET /:project_id/repository/edit(.:format) projects/repositories#edit
2015-01-19 15:37:20 -05:00
describe Projects :: RepositoriesController , 'routing' do
it 'to #archive' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/repository/archive' ) ) . to route_to ( 'projects/repositories#archive' , namespace_id : 'gitlab' , project_id : 'gitlabhq' )
2012-09-16 12:42:52 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #archive format:zip' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/repository/archive.zip' ) ) . to route_to ( 'projects/repositories#archive' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , format : 'zip' )
2013-12-20 14:12:44 -05:00
end
2015-01-19 15:37:20 -05:00
it 'to #archive format:tar.bz2' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/repository/archive.tar.bz2' ) ) . to route_to ( 'projects/repositories#archive' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , format : 'tar.bz2' )
2013-12-20 14:12:44 -05:00
end
2015-01-19 15:37:20 -05:00
it 'to #show' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/repository' ) ) . to route_to ( 'projects/repositories#show' , namespace_id : 'gitlab' , project_id : 'gitlabhq' )
2012-09-16 12:42:52 -04:00
end
end
2015-01-19 15:37:20 -05:00
describe Projects :: BranchesController , 'routing' do
it 'to #branches' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/branches' ) ) . to route_to ( 'projects/branches#index' , namespace_id : 'gitlab' , project_id : 'gitlabhq' )
expect ( delete ( '/gitlab/gitlabhq/branches/feature%2345' ) ) . to route_to ( 'projects/branches#destroy' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'feature#45' )
expect ( delete ( '/gitlab/gitlabhq/branches/feature%2B45' ) ) . to route_to ( 'projects/branches#destroy' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'feature+45' )
expect ( delete ( '/gitlab/gitlabhq/branches/feature@45' ) ) . to route_to ( 'projects/branches#destroy' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'feature@45' )
expect ( delete ( '/gitlab/gitlabhq/branches/feature%2345/foo/bar/baz' ) ) . to route_to ( 'projects/branches#destroy' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'feature#45/foo/bar/baz' )
expect ( delete ( '/gitlab/gitlabhq/branches/feature%2B45/foo/bar/baz' ) ) . to route_to ( 'projects/branches#destroy' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'feature+45/foo/bar/baz' )
expect ( delete ( '/gitlab/gitlabhq/branches/feature@45/foo/bar/baz' ) ) . to route_to ( 'projects/branches#destroy' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'feature@45/foo/bar/baz' )
2013-07-17 01:43:56 -04:00
end
end
2015-01-19 15:37:20 -05:00
describe Projects :: TagsController , 'routing' do
it 'to #tags' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/tags' ) ) . to route_to ( 'projects/tags#index' , namespace_id : 'gitlab' , project_id : 'gitlabhq' )
expect ( delete ( '/gitlab/gitlabhq/tags/feature%2345' ) ) . to route_to ( 'projects/tags#destroy' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'feature#45' )
expect ( delete ( '/gitlab/gitlabhq/tags/feature%2B45' ) ) . to route_to ( 'projects/tags#destroy' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'feature+45' )
expect ( delete ( '/gitlab/gitlabhq/tags/feature@45' ) ) . to route_to ( 'projects/tags#destroy' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'feature@45' )
expect ( delete ( '/gitlab/gitlabhq/tags/feature%2345/foo/bar/baz' ) ) . to route_to ( 'projects/tags#destroy' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'feature#45/foo/bar/baz' )
expect ( delete ( '/gitlab/gitlabhq/tags/feature%2B45/foo/bar/baz' ) ) . to route_to ( 'projects/tags#destroy' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'feature+45/foo/bar/baz' )
expect ( delete ( '/gitlab/gitlabhq/tags/feature@45/foo/bar/baz' ) ) . to route_to ( 'projects/tags#destroy' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'feature@45/foo/bar/baz' )
2013-07-17 01:43:56 -04:00
end
end
2012-09-16 12:42:52 -04:00
# project_deploy_keys GET /:project_id/deploy_keys(.:format) deploy_keys#index
# POST /:project_id/deploy_keys(.:format) deploy_keys#create
# new_project_deploy_key GET /:project_id/deploy_keys/new(.:format) deploy_keys#new
# project_deploy_key GET /:project_id/deploy_keys/:id(.:format) deploy_keys#show
# DELETE /:project_id/deploy_keys/:id(.:format) deploy_keys#destroy
2015-01-19 15:37:20 -05:00
describe Projects :: DeployKeysController , 'routing' do
it_behaves_like 'RESTful project resources' do
2015-06-03 17:27:23 -04:00
let ( :actions ) { [ :index , :new , :create ] }
2012-09-16 12:42:52 -04:00
let ( :controller ) { 'deploy_keys' }
end
end
# project_protected_branches GET /:project_id/protected_branches(.:format) protected_branches#index
# POST /:project_id/protected_branches(.:format) protected_branches#create
# project_protected_branch DELETE /:project_id/protected_branches/:id(.:format) protected_branches#destroy
2015-01-19 15:37:20 -05:00
describe Projects :: ProtectedBranchesController , 'routing' do
it_behaves_like 'RESTful project resources' do
2012-09-16 12:42:52 -04:00
let ( :actions ) { [ :index , :create , :destroy ] }
let ( :controller ) { 'protected_branches' }
end
end
2013-01-09 02:47:25 -05:00
# switch_project_refs GET /:project_id/refs/switch(.:format) refs#switch
# logs_tree_project_ref GET /:project_id/refs/:id/logs_tree(.:format) refs#logs_tree
# logs_file_project_ref GET /:project_id/refs/:id/logs_tree/:path(.:format) refs#logs_tree
2015-01-19 15:37:20 -05:00
describe Projects :: RefsController , 'routing' do
it 'to #switch' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/refs/switch' ) ) . to route_to ( 'projects/refs#switch' , namespace_id : 'gitlab' , project_id : 'gitlabhq' )
2015-01-19 15:37:20 -05:00
end
it 'to #logs_tree' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/refs/stable/logs_tree' ) ) . to route_to ( 'projects/refs#logs_tree' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'stable' )
expect ( get ( '/gitlab/gitlabhq/refs/feature%2345/logs_tree' ) ) . to route_to ( 'projects/refs#logs_tree' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'feature#45' )
expect ( get ( '/gitlab/gitlabhq/refs/feature%2B45/logs_tree' ) ) . to route_to ( 'projects/refs#logs_tree' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'feature+45' )
expect ( get ( '/gitlab/gitlabhq/refs/feature@45/logs_tree' ) ) . to route_to ( 'projects/refs#logs_tree' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'feature@45' )
expect ( get ( '/gitlab/gitlabhq/refs/stable/logs_tree/foo/bar/baz' ) ) . to route_to ( 'projects/refs#logs_tree' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'stable' , path : 'foo/bar/baz' )
expect ( get ( '/gitlab/gitlabhq/refs/feature%2345/logs_tree/foo/bar/baz' ) ) . to route_to ( 'projects/refs#logs_tree' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'feature#45' , path : 'foo/bar/baz' )
expect ( get ( '/gitlab/gitlabhq/refs/feature%2B45/logs_tree/foo/bar/baz' ) ) . to route_to ( 'projects/refs#logs_tree' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'feature+45' , path : 'foo/bar/baz' )
expect ( get ( '/gitlab/gitlabhq/refs/feature@45/logs_tree/foo/bar/baz' ) ) . to route_to ( 'projects/refs#logs_tree' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'feature@45' , path : 'foo/bar/baz' )
expect ( get ( '/gitlab/gitlabhq/refs/stable/logs_tree/files.scss' ) ) . to route_to ( 'projects/refs#logs_tree' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'stable' , path : 'files.scss' )
2012-09-16 12:42:52 -04:00
end
end
2015-05-29 00:09:28 -04:00
# diffs_namespace_project_merge_request GET /:namespace_id/:project_id/merge_requests/:id/diffs(.:format) projects/merge_requests#diffs
# commits_namespace_project_merge_request GET /:namespace_id/:project_id/merge_requests/:id/commits(.:format) projects/merge_requests#commits
2015-08-11 08:33:31 -04:00
# merge_namespace_project_merge_request POST /:namespace_id/:project_id/merge_requests/:id/merge(.:format) projects/merge_requests#merge
# merge_check_namespace_project_merge_request GET /:namespace_id/:project_id/merge_requests/:id/merge_check(.:format) projects/merge_requests#merge_check
2015-05-29 00:09:28 -04:00
# ci_status_namespace_project_merge_request GET /:namespace_id/:project_id/merge_requests/:id/ci_status(.:format) projects/merge_requests#ci_status
# toggle_subscription_namespace_project_merge_request POST /:namespace_id/:project_id/merge_requests/:id/toggle_subscription(.:format) projects/merge_requests#toggle_subscription
# branch_from_namespace_project_merge_requests GET /:namespace_id/:project_id/merge_requests/branch_from(.:format) projects/merge_requests#branch_from
# branch_to_namespace_project_merge_requests GET /:namespace_id/:project_id/merge_requests/branch_to(.:format) projects/merge_requests#branch_to
# update_branches_namespace_project_merge_requests GET /:namespace_id/:project_id/merge_requests/update_branches(.:format) projects/merge_requests#update_branches
# namespace_project_merge_requests GET /:namespace_id/:project_id/merge_requests(.:format) projects/merge_requests#index
# POST /:namespace_id/:project_id/merge_requests(.:format) projects/merge_requests#create
# new_namespace_project_merge_request GET /:namespace_id/:project_id/merge_requests/new(.:format) projects/merge_requests#new
# edit_namespace_project_merge_request GET /:namespace_id/:project_id/merge_requests/:id/edit(.:format) projects/merge_requests#edit
# namespace_project_merge_request GET /:namespace_id/:project_id/merge_requests/:id(.:format) projects/merge_requests#show
# PATCH /:namespace_id/:project_id/merge_requests/:id(.:format) projects/merge_requests#update
# PUT /:namespace_id/:project_id/merge_requests/:id(.:format) projects/merge_requests#update
2015-01-19 15:37:20 -05:00
describe Projects :: MergeRequestsController , 'routing' do
it 'to #diffs' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/merge_requests/1/diffs' ) ) . to route_to ( 'projects/merge_requests#diffs' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : '1' )
2012-09-16 12:42:52 -04:00
end
2015-05-29 00:09:28 -04:00
it 'to #commits' do
expect ( get ( '/gitlab/gitlabhq/merge_requests/1/commits' ) ) . to route_to ( 'projects/merge_requests#commits' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : '1' )
end
2015-08-11 08:33:31 -04:00
it 'to #merge' do
expect ( post ( '/gitlab/gitlabhq/merge_requests/1/merge' ) ) . to route_to (
'projects/merge_requests#merge' ,
2015-01-24 13:02:58 -05:00
namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : '1'
2014-04-17 11:13:31 -04:00
)
2012-09-16 12:42:52 -04:00
end
2015-08-11 08:33:31 -04:00
it 'to #merge_check' do
expect ( get ( '/gitlab/gitlabhq/merge_requests/1/merge_check' ) ) . to route_to ( 'projects/merge_requests#merge_check' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : '1' )
2012-09-16 12:42:52 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #branch_from' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/merge_requests/branch_from' ) ) . to route_to ( 'projects/merge_requests#branch_from' , namespace_id : 'gitlab' , project_id : 'gitlabhq' )
2012-09-16 12:42:52 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #branch_to' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/merge_requests/branch_to' ) ) . to route_to ( 'projects/merge_requests#branch_to' , namespace_id : 'gitlab' , project_id : 'gitlabhq' )
2012-09-16 12:42:52 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #show' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/merge_requests/1.diff' ) ) . to route_to ( 'projects/merge_requests#show' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : '1' , format : 'diff' )
expect ( get ( '/gitlab/gitlabhq/merge_requests/1.patch' ) ) . to route_to ( 'projects/merge_requests#show' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : '1' , format : 'patch' )
2012-11-22 15:50:36 -05:00
end
2015-01-19 15:37:20 -05:00
it_behaves_like 'RESTful project resources' do
2012-09-16 12:42:52 -04:00
let ( :controller ) { 'merge_requests' }
2012-12-20 08:39:54 -05:00
let ( :actions ) { [ :index , :create , :new , :edit , :show , :update ] }
2012-09-16 12:42:52 -04:00
end
end
# raw_project_snippet GET /:project_id/snippets/:id/raw(.:format) snippets#raw
# project_snippets GET /:project_id/snippets(.:format) snippets#index
# POST /:project_id/snippets(.:format) snippets#create
# new_project_snippet GET /:project_id/snippets/new(.:format) snippets#new
# edit_project_snippet GET /:project_id/snippets/:id/edit(.:format) snippets#edit
# project_snippet GET /:project_id/snippets/:id(.:format) snippets#show
# PUT /:project_id/snippets/:id(.:format) snippets#update
# DELETE /:project_id/snippets/:id(.:format) snippets#destroy
2015-01-19 15:37:20 -05:00
describe SnippetsController , 'routing' do
it 'to #raw' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/snippets/1/raw' ) ) . to route_to ( 'projects/snippets#raw' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : '1' )
2012-09-16 12:42:52 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #index' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/snippets' ) ) . to route_to ( 'projects/snippets#index' , namespace_id : 'gitlab' , project_id : 'gitlabhq' )
2013-03-23 15:13:51 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #create' do
2015-01-24 13:02:58 -05:00
expect ( post ( '/gitlab/gitlabhq/snippets' ) ) . to route_to ( 'projects/snippets#create' , namespace_id : 'gitlab' , project_id : 'gitlabhq' )
2013-03-23 15:13:51 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #new' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/snippets/new' ) ) . to route_to ( 'projects/snippets#new' , namespace_id : 'gitlab' , project_id : 'gitlabhq' )
2013-03-23 15:13:51 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #edit' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/snippets/1/edit' ) ) . to route_to ( 'projects/snippets#edit' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : '1' )
2013-03-23 15:13:51 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #show' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/snippets/1' ) ) . to route_to ( 'projects/snippets#show' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : '1' )
2013-03-23 15:13:51 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #update' do
2015-01-24 13:02:58 -05:00
expect ( put ( '/gitlab/gitlabhq/snippets/1' ) ) . to route_to ( 'projects/snippets#update' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : '1' )
2013-03-23 15:13:51 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #destroy' do
2015-01-24 13:02:58 -05:00
expect ( delete ( '/gitlab/gitlabhq/snippets/1' ) ) . to route_to ( 'projects/snippets#destroy' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : '1' )
2012-09-16 12:42:52 -04:00
end
end
# test_project_hook GET /:project_id/hooks/:id/test(.:format) hooks#test
# project_hooks GET /:project_id/hooks(.:format) hooks#index
# POST /:project_id/hooks(.:format) hooks#create
# project_hook DELETE /:project_id/hooks/:id(.:format) hooks#destroy
2015-01-19 15:37:20 -05:00
describe Projects :: HooksController , 'routing' do
it 'to #test' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/hooks/1/test' ) ) . to route_to ( 'projects/hooks#test' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : '1' )
2012-09-16 12:42:52 -04:00
end
2015-01-19 15:37:20 -05:00
it_behaves_like 'RESTful project resources' do
2012-09-16 12:42:52 -04:00
let ( :actions ) { [ :index , :create , :destroy ] }
let ( :controller ) { 'hooks' }
end
end
2013-05-05 10:01:10 -04:00
# project_commit GET /:project_id/commit/:id(.:format) commit#show {id: /[[:alnum:]]{6,40}/, project_id: /[^\/]+/}
2015-01-19 15:37:20 -05:00
describe Projects :: CommitController , 'routing' do
it 'to #show' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/commit/4246fb' ) ) . to route_to ( 'projects/commit#show' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : '4246fb' )
expect ( get ( '/gitlab/gitlabhq/commit/4246fb.diff' ) ) . to route_to ( 'projects/commit#show' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : '4246fb' , format : 'diff' )
expect ( get ( '/gitlab/gitlabhq/commit/4246fb.patch' ) ) . to route_to ( 'projects/commit#show' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : '4246fb' , format : 'patch' )
expect ( get ( '/gitlab/gitlabhq/commit/4246fbd13872934f72a8fd0d6fb1317b47b59cb5' ) ) . to route_to ( 'projects/commit#show' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : '4246fbd13872934f72a8fd0d6fb1317b47b59cb5' )
2012-09-17 10:06:56 -04:00
end
end
2012-09-16 12:42:52 -04:00
# patch_project_commit GET /:project_id/commits/:id/patch(.:format) commits#patch
# project_commits GET /:project_id/commits(.:format) commits#index
# POST /:project_id/commits(.:format) commits#create
# project_commit GET /:project_id/commits/:id(.:format) commits#show
2015-01-19 15:37:20 -05:00
describe Projects :: CommitsController , 'routing' do
it_behaves_like 'RESTful project resources' do
2012-09-25 22:32:54 -04:00
let ( :actions ) { [ :show ] }
2012-09-16 12:42:52 -04:00
let ( :controller ) { 'commits' }
end
2013-03-05 22:59:28 -05:00
2015-01-19 15:37:20 -05:00
it 'to #show' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/commits/master.atom' ) ) . to route_to ( 'projects/commits#show' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'master' , format : 'atom' )
2013-03-05 22:59:28 -05:00
end
2012-09-16 12:42:52 -04:00
end
2015-03-13 11:22:03 -04:00
# project_project_members GET /:project_id/project_members(.:format) project_members#index
# POST /:project_id/project_members(.:format) project_members#create
# PUT /:project_id/project_members/:id(.:format) project_members#update
# DELETE /:project_id/project_members/:id(.:format) project_members#destroy
describe Projects :: ProjectMembersController , 'routing' do
2015-01-19 15:37:20 -05:00
it_behaves_like 'RESTful project resources' do
2015-03-13 11:22:03 -04:00
let ( :actions ) { [ :index , :create , :update , :destroy ] }
let ( :controller ) { 'project_members' }
2012-09-16 12:42:52 -04:00
end
end
# project_milestones GET /:project_id/milestones(.:format) milestones#index
# POST /:project_id/milestones(.:format) milestones#create
# new_project_milestone GET /:project_id/milestones/new(.:format) milestones#new
# edit_project_milestone GET /:project_id/milestones/:id/edit(.:format) milestones#edit
# project_milestone GET /:project_id/milestones/:id(.:format) milestones#show
# PUT /:project_id/milestones/:id(.:format) milestones#update
# DELETE /:project_id/milestones/:id(.:format) milestones#destroy
2015-01-19 15:37:20 -05:00
describe Projects :: MilestonesController , 'routing' do
it_behaves_like 'RESTful project resources' do
2012-09-16 12:42:52 -04:00
let ( :controller ) { 'milestones' }
2012-12-20 08:39:54 -05:00
let ( :actions ) { [ :index , :create , :new , :edit , :show , :update ] }
2012-09-16 12:42:52 -04:00
end
end
# project_labels GET /:project_id/labels(.:format) labels#index
2015-01-19 15:37:20 -05:00
describe Projects :: LabelsController , 'routing' do
it 'to #index' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/labels' ) ) . to route_to ( 'projects/labels#index' , namespace_id : 'gitlab' , project_id : 'gitlabhq' )
2012-09-16 12:42:52 -04:00
end
end
# sort_project_issues POST /:project_id/issues/sort(.:format) issues#sort
# bulk_update_project_issues POST /:project_id/issues/bulk_update(.:format) issues#bulk_update
# search_project_issues GET /:project_id/issues/search(.:format) issues#search
# project_issues GET /:project_id/issues(.:format) issues#index
# POST /:project_id/issues(.:format) issues#create
# new_project_issue GET /:project_id/issues/new(.:format) issues#new
# edit_project_issue GET /:project_id/issues/:id/edit(.:format) issues#edit
# project_issue GET /:project_id/issues/:id(.:format) issues#show
# PUT /:project_id/issues/:id(.:format) issues#update
# DELETE /:project_id/issues/:id(.:format) issues#destroy
2015-01-19 15:37:20 -05:00
describe Projects :: IssuesController , 'routing' do
it 'to #bulk_update' do
2015-01-24 13:02:58 -05:00
expect ( post ( '/gitlab/gitlabhq/issues/bulk_update' ) ) . to route_to ( 'projects/issues#bulk_update' , namespace_id : 'gitlab' , project_id : 'gitlabhq' )
2012-09-16 12:42:52 -04:00
end
2015-01-19 15:37:20 -05:00
it_behaves_like 'RESTful project resources' do
2012-09-16 12:42:52 -04:00
let ( :controller ) { 'issues' }
2012-12-20 08:39:54 -05:00
let ( :actions ) { [ :index , :create , :new , :edit , :show , :update ] }
2012-09-16 12:42:52 -04:00
end
end
# project_notes GET /:project_id/notes(.:format) notes#index
# POST /:project_id/notes(.:format) notes#create
# project_note DELETE /:project_id/notes/:id(.:format) notes#destroy
2015-01-19 15:37:20 -05:00
describe Projects :: NotesController , 'routing' do
it_behaves_like 'RESTful project resources' do
2012-09-16 12:42:52 -04:00
let ( :actions ) { [ :index , :create , :destroy ] }
let ( :controller ) { 'notes' }
end
end
2012-09-16 21:14:21 -04:00
2013-05-05 10:01:10 -04:00
# project_blame GET /:project_id/blame/:id(.:format) blame#show {id: /.+/, project_id: /[^\/]+/}
2015-01-19 15:37:20 -05:00
describe Projects :: BlameController , 'routing' do
it 'to #show' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/blame/master/app/models/project.rb' ) ) . to route_to ( 'projects/blame#show' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'master/app/models/project.rb' )
expect ( get ( '/gitlab/gitlabhq/blame/master/files.scss' ) ) . to route_to ( 'projects/blame#show' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'master/files.scss' )
2012-09-17 13:36:13 -04:00
end
end
2013-05-05 10:01:10 -04:00
# project_blob GET /:project_id/blob/:id(.:format) blob#show {id: /.+/, project_id: /[^\/]+/}
2015-01-19 15:37:20 -05:00
describe Projects :: BlobController , 'routing' do
it 'to #show' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/blob/master/app/models/project.rb' ) ) . to route_to ( 'projects/blob#show' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'master/app/models/project.rb' )
expect ( get ( '/gitlab/gitlabhq/blob/master/app/models/compare.rb' ) ) . to route_to ( 'projects/blob#show' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'master/app/models/compare.rb' )
expect ( get ( '/gitlab/gitlabhq/blob/master/app/models/diff.js' ) ) . to route_to ( 'projects/blob#show' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'master/app/models/diff.js' )
expect ( get ( '/gitlab/gitlabhq/blob/master/files.scss' ) ) . to route_to ( 'projects/blob#show' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'master/files.scss' )
2012-09-17 13:49:57 -04:00
end
end
2013-05-05 10:01:10 -04:00
# project_tree GET /:project_id/tree/:id(.:format) tree#show {id: /.+/, project_id: /[^\/]+/}
2015-01-19 15:37:20 -05:00
describe Projects :: TreeController , 'routing' do
it 'to #show' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/tree/master/app/models/project.rb' ) ) . to route_to ( 'projects/tree#show' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'master/app/models/project.rb' )
expect ( get ( '/gitlab/gitlabhq/tree/master/files.scss' ) ) . to route_to ( 'projects/tree#show' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'master/files.scss' )
2012-09-17 12:26:29 -04:00
end
end
2015-01-26 19:08:59 -05:00
describe Projects :: BlobController , 'routing' do
it 'to #edit' do
2015-02-12 13:17:35 -05:00
expect ( get ( '/gitlab/gitlabhq/edit/master/app/models/project.rb' ) ) . to (
2015-01-26 19:08:59 -05:00
route_to ( 'projects/blob#edit' ,
2015-01-24 13:02:58 -05:00
namespace_id : 'gitlab' , project_id : 'gitlabhq' ,
2014-10-06 17:37:27 -04:00
id : 'master/app/models/project.rb' ) )
end
it 'to #preview' do
2015-02-12 13:17:35 -05:00
expect ( post ( '/gitlab/gitlabhq/preview/master/app/models/project.rb' ) ) . to (
2015-01-26 19:08:59 -05:00
route_to ( 'projects/blob#preview' ,
2015-01-24 13:02:58 -05:00
namespace_id : 'gitlab' , project_id : 'gitlabhq' ,
2014-10-06 17:37:27 -04:00
id : 'master/app/models/project.rb' ) )
end
end
2013-05-05 10:01:10 -04:00
# project_compare_index GET /:project_id/compare(.:format) compare#index {id: /[^\/]+/, project_id: /[^\/]+/}
# POST /:project_id/compare(.:format) compare#create {id: /[^\/]+/, project_id: /[^\/]+/}
# project_compare /:project_id/compare/:from...:to(.:format) compare#show {from: /.+/, to: /.+/, id: /[^\/]+/, project_id: /[^\/]+/}
2015-01-19 15:37:20 -05:00
describe Projects :: CompareController , 'routing' do
it 'to #index' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/compare' ) ) . to route_to ( 'projects/compare#index' , namespace_id : 'gitlab' , project_id : 'gitlabhq' )
2012-09-25 22:32:54 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #compare' do
2015-01-24 13:02:58 -05:00
expect ( post ( '/gitlab/gitlabhq/compare' ) ) . to route_to ( 'projects/compare#create' , namespace_id : 'gitlab' , project_id : 'gitlabhq' )
2012-09-25 23:10:50 -04:00
end
2015-01-19 15:37:20 -05:00
it 'to #show' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/compare/master...stable' ) ) . to route_to ( 'projects/compare#show' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , from : 'master' , to : 'stable' )
expect ( get ( '/gitlab/gitlabhq/compare/issue/1234...stable' ) ) . to route_to ( 'projects/compare#show' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , from : 'issue/1234' , to : 'stable' )
2012-09-20 15:20:48 -04:00
end
end
2013-03-05 22:59:28 -05:00
2015-01-19 15:37:20 -05:00
describe Projects :: NetworkController , 'routing' do
it 'to #show' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/network/master' ) ) . to route_to ( 'projects/network#show' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'master' )
expect ( get ( '/gitlab/gitlabhq/network/master.json' ) ) . to route_to ( 'projects/network#show' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'master' , format : 'json' )
2013-06-11 02:54:01 -04:00
end
end
2015-01-19 15:37:20 -05:00
describe Projects :: GraphsController , 'routing' do
it 'to #show' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/graphs/master' ) ) . to route_to ( 'projects/graphs#show' , namespace_id : 'gitlab' , project_id : 'gitlabhq' , id : 'master' )
2013-03-05 22:59:28 -05:00
end
end
2014-11-14 05:55:13 -05:00
2015-01-19 15:37:20 -05:00
describe Projects :: ForksController , 'routing' do
it 'to #new' do
2015-01-24 13:02:58 -05:00
expect ( get ( '/gitlab/gitlabhq/fork/new' ) ) . to route_to ( 'projects/forks#new' , namespace_id : 'gitlab' , project_id : 'gitlabhq' )
2014-11-14 05:55:13 -05:00
end
2015-01-19 15:37:20 -05:00
it 'to #create' do
2015-01-24 13:02:58 -05:00
expect ( post ( '/gitlab/gitlabhq/fork' ) ) . to route_to ( 'projects/forks#create' , namespace_id : 'gitlab' , project_id : 'gitlabhq' )
2014-11-14 05:55:13 -05:00
end
2015-01-19 15:37:20 -05:00
end
2014-01-25 12:15:44 -05:00
# project_avatar DELETE /project/avatar(.:format) projects/avatars#destroy
describe Projects :: AvatarsController , 'routing' do
it 'to #destroy' do
2015-02-12 13:17:35 -05:00
expect ( delete ( '/gitlab/gitlabhq/avatar' ) ) . to route_to (
2015-01-24 13:02:58 -05:00
'projects/avatars#destroy' , namespace_id : 'gitlab' , project_id : 'gitlabhq' )
2014-01-25 12:15:44 -05:00
end
2014-11-14 05:55:13 -05:00
end