Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
b6c6a5b1
Commit
b6c6a5b1
authored
Sep 16, 2012
by
Alex Denisov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into ssh_keys_api
parents
87d40fd2
eed1b52f
Changes
29
Show whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
886 additions
and
172 deletions
+886
-172
app/controllers/admin/dashboard_controller.rb
app/controllers/admin/dashboard_controller.rb
+1
-5
app/controllers/admin/hooks_controller.rb
app/controllers/admin/hooks_controller.rb
+2
-6
app/controllers/admin/logs_controller.rb
app/controllers/admin/logs_controller.rb
+1
-5
app/controllers/admin/projects_controller.rb
app/controllers/admin/projects_controller.rb
+3
-6
app/controllers/admin/resque_controller.rb
app/controllers/admin/resque_controller.rb
+2
-3
app/controllers/admin/team_members_controller.rb
app/controllers/admin/team_members_controller.rb
+1
-5
app/controllers/admin/users_controller.rb
app/controllers/admin/users_controller.rb
+6
-10
app/controllers/admin_controller.rb
app/controllers/admin_controller.rb
+11
-0
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+0
-4
app/controllers/issues_controller.rb
app/controllers/issues_controller.rb
+1
-3
app/controllers/profile_controller.rb
app/controllers/profile_controller.rb
+0
-3
app/controllers/team_members_controller.rb
app/controllers/team_members_controller.rb
+7
-4
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+1
-1
app/helpers/tab_helper.rb
app/helpers/tab_helper.rb
+1
-1
app/views/projects/_project_head.html.haml
app/views/projects/_project_head.html.haml
+2
-2
app/views/team_members/_form.html.haml
app/views/team_members/_form.html.haml
+1
-1
app/views/team_members/_team.html.haml
app/views/team_members/_team.html.haml
+0
-0
app/views/team_members/index.html.haml
app/views/team_members/index.html.haml
+2
-4
app/views/team_members/show.html.haml
app/views/team_members/show.html.haml
+1
-1
config/routes.rb
config/routes.rb
+55
-54
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+1
-1
lib/api/helpers.rb
lib/api/helpers.rb
+8
-0
lib/api/issues.rb
lib/api/issues.rb
+6
-18
lib/api/milestones.rb
lib/api/milestones.rb
+4
-14
lib/api/projects.rb
lib/api/projects.rb
+18
-20
spec/requests/security/project_access_spec.rb
spec/requests/security/project_access_spec.rb
+1
-1
spec/routing/admin_routing_spec.rb
spec/routing/admin_routing_spec.rb
+166
-0
spec/routing/project_routing_spec.rb
spec/routing/project_routing_spec.rb
+398
-0
spec/routing/routing_spec.rb
spec/routing/routing_spec.rb
+186
-0
No files found.
app/controllers/admin/dashboard_controller.rb
View file @
b6c6a5b1
class
Admin::DashboardController
<
ApplicationController
layout
"admin"
before_filter
:authenticate_user!
before_filter
:authenticate_admin!
class
Admin::DashboardController
<
AdminController
def
index
@workers
=
Resque
.
workers
@pending_jobs
=
Resque
.
size
(
:post_receive
)
...
...
app/controllers/admin/hooks_controller.rb
View file @
b6c6a5b1
class
Admin::HooksController
<
ApplicationController
layout
"admin"
before_filter
:authenticate_user!
before_filter
:authenticate_admin!
class
Admin::HooksController
<
AdminController
def
index
@hooks
=
SystemHook
.
all
@hook
=
SystemHook
.
new
...
...
app/controllers/admin/logs_controller.rb
View file @
b6c6a5b1
class
Admin::LogsController
<
ApplicationController
layout
"admin"
before_filter
:authenticate_user!
before_filter
:authenticate_admin!
class
Admin::LogsController
<
AdminController
end
app/controllers/admin/projects_controller.rb
View file @
b6c6a5b1
class
Admin::ProjectsController
<
ApplicationController
layout
"admin"
before_filter
:authenticate_user!
before_filter
:authenticate_admin!
class
Admin::ProjectsController
<
AdminController
before_filter
:admin_project
,
only:
[
:edit
,
:show
,
:update
,
:destroy
,
:team_update
]
def
index
...
...
app/controllers/admin/resque_controller.rb
View file @
b6c6a5b1
class
Admin::ResqueController
<
ApplicationController
layout
'admin'
class
Admin::ResqueController
<
AdminController
def
show
end
end
app/controllers/admin/team_members_controller.rb
View file @
b6c6a5b1
class
Admin::TeamMembersController
<
ApplicationController
layout
"admin"
before_filter
:authenticate_user!
before_filter
:authenticate_admin!
class
Admin::TeamMembersController
<
AdminController
def
edit
@admin_team_member
=
UsersProject
.
find
(
params
[
:id
])
end
...
...
app/controllers/admin/users_controller.rb
View file @
b6c6a5b1
class
Admin::UsersController
<
ApplicationController
layout
"admin"
before_filter
:authenticate_user!
before_filter
:authenticate_admin!
class
Admin::UsersController
<
AdminController
def
index
@admin_users
=
User
.
scoped
@admin_users
=
@admin_users
.
filter
(
params
[
:filter
])
...
...
app/controllers/admin_controller.rb
0 → 100644
View file @
b6c6a5b1
# Provides a base class for Admin controllers to subclass
#
# Automatically sets the layout and ensures an administrator is logged in
class
AdminController
<
ApplicationController
layout
'admin'
before_filter
:authenticate_admin!
def
authenticate_admin!
return
render_404
unless
current_user
.
is_admin?
end
end
app/controllers/application_controller.rb
View file @
b6c6a5b1
...
...
@@ -84,10 +84,6 @@ class ApplicationController < ActionController::Base
abilities
<<
Ability
end
def
authenticate_admin!
return
render_404
unless
current_user
.
is_admin?
end
def
authorize_project!
(
action
)
return
access_denied!
unless
can?
(
current_user
,
action
,
project
)
end
...
...
app/controllers/issues_controller.rb
View file @
b6c6a5b1
...
...
@@ -17,7 +17,7 @@ class IssuesController < ApplicationController
before_filter
:authorize_write_issue!
,
only:
[
:new
,
:create
]
# Allow modify issue
before_filter
:authorize_modify_issue!
,
only:
[
:
close
,
:
edit
,
:update
]
before_filter
:authorize_modify_issue!
,
only:
[
:edit
,
:update
]
# Allow destroy issue
before_filter
:authorize_admin_issue!
,
only:
[
:destroy
]
...
...
@@ -87,8 +87,6 @@ class IssuesController < ApplicationController
end
def
destroy
return
access_denied!
unless
can?
(
current_user
,
:admin_issue
,
@issue
)
@issue
.
destroy
respond_to
do
|
format
|
...
...
app/controllers/profile_controller.rb
View file @
b6c6a5b1
...
...
@@ -16,9 +16,6 @@ class ProfileController < ApplicationController
def
token
end
def
password
end
def
password_update
params
[
:user
].
reject!
{
|
k
,
v
|
k
!=
"password"
&&
k
!=
"password_confirmation"
}
...
...
app/controllers/team_members_controller.rb
View file @
b6c6a5b1
...
...
@@ -5,7 +5,10 @@ class TeamMembersController < ApplicationController
# Authorize
before_filter
:add_project_abilities
before_filter
:authorize_read_project!
before_filter
:authorize_admin_project!
,
except:
[
:show
]
before_filter
:authorize_admin_project!
,
except:
[
:index
,
:show
]
def
index
end
def
show
@team_member
=
project
.
users_projects
.
find
(
params
[
:id
])
...
...
@@ -22,7 +25,7 @@ class TeamMembersController < ApplicationController
params
[
:project_access
]
)
redirect_to
team_project
_path
(
@project
)
redirect_to
project_team_index
_path
(
@project
)
end
def
update
...
...
@@ -32,7 +35,7 @@ class TeamMembersController < ApplicationController
unless
@team_member
.
valid?
flash
[
:alert
]
=
"User should have at least one role"
end
redirect_to
team_project
_path
(
@project
)
redirect_to
project_team_index
_path
(
@project
)
end
def
destroy
...
...
@@ -40,7 +43,7 @@ class TeamMembersController < ApplicationController
@team_member
.
destroy
respond_to
do
|
format
|
format
.
html
{
redirect_to
team_project
_path
(
@project
)
}
format
.
html
{
redirect_to
project_team_index
_path
(
@project
)
}
format
.
js
{
render
nothing:
true
}
end
end
...
...
app/helpers/application_helper.rb
View file @
b6c6a5b1
...
...
@@ -62,7 +62,7 @@ module ApplicationHelper
{
label:
"
#{
@project
.
name
}
/ Wall"
,
url:
wall_project_path
(
@project
)
},
{
label:
"
#{
@project
.
name
}
/ Tree"
,
url:
tree_project_ref_path
(
@project
,
@project
.
root_ref
)
},
{
label:
"
#{
@project
.
name
}
/ Commits"
,
url:
project_commits_path
(
@project
)
},
{
label:
"
#{
@project
.
name
}
/ Team"
,
url:
team_project
_path
(
@project
)
}
{
label:
"
#{
@project
.
name
}
/ Team"
,
url:
project_team_index
_path
(
@project
)
}
]
end
...
...
app/helpers/tab_helper.rb
View file @
b6c6a5b1
...
...
@@ -8,7 +8,7 @@ module TabHelper
end
def
project_tab_class
[
:show
,
:files
,
:
team
,
:
edit
,
:update
].
each
do
|
action
|
[
:show
,
:files
,
:edit
,
:update
].
each
do
|
action
|
return
"current"
if
current_page?
(
controller:
"projects"
,
action:
action
,
id:
@project
)
end
...
...
app/views/projects/_project_head.html.haml
View file @
b6c6a5b1
...
...
@@ -3,8 +3,8 @@
=
link_to
project_path
(
@project
),
class:
"activities-tab tab"
do
%i
.icon-home
Show
%li
{
class:
" #{'active' if (controller.controller_name == "
team_members
") || current_page?(
team_project
_path(@project)) }"
}
=
link_to
team_project
_path
(
@project
),
class:
"team-tab tab"
do
%li
{
class:
" #{'active' if (controller.controller_name == "
team_members
") || current_page?(
project_team_index
_path(@project)) }"
}
=
link_to
project_team_index
_path
(
@project
),
class:
"team-tab tab"
do
%i
.icon-user
Team
%li
{
class:
"#{'active' if current_page?(files_project_path(@project)) }"
}
...
...
app/views/team_members/_form.html.haml
View file @
b6c6a5b1
...
...
@@ -20,4 +20,4 @@
.actions
=
f
.
submit
'Save'
,
class:
"btn save-btn"
=
link_to
"Cancel"
,
team_project
_path
(
@project
),
class:
"btn cancel-btn"
=
link_to
"Cancel"
,
project_team_index
_path
(
@project
),
class:
"btn cancel-btn"
app/views/
project
s/_team.html.haml
→
app/views/
team_member
s/_team.html.haml
View file @
b6c6a5b1
File moved
app/views/
projects/team
.html.haml
→
app/views/
team_members/index
.html.haml
View file @
b6c6a5b1
=
render
"project_head"
=
render
"project
s/project
_head"
%h3
.page_title
Team Members
%small
(
#{
@project
.
users_projects
.
count
}
)
...
...
@@ -10,6 +10,4 @@
Read more about project permissions
%strong
=
link_to
"here"
,
help_permissions_path
,
class:
"vlink"
=
render
partial:
"team"
,
locals:
{
project:
@project
}
=
render
partial:
"team_members/team"
,
locals:
{
project:
@project
}
app/views/team_members/show.html.haml
View file @
b6c6a5b1
...
...
@@ -14,7 +14,7 @@
%hr
.back_link
%br
=
link_to
team_project
_path
(
@project
),
class:
""
do
=
link_to
project_team_index
_path
(
@project
),
class:
""
do
←
To team list
%br
.row
...
...
config/routes.rb
View file @
b6c6a5b1
...
...
@@ -10,7 +10,7 @@ Gitlab::Application.routes.draw do
# Optionally, enable Resque here
require
'resque/server'
mount
Resque
::
Server
.
new
,
at:
'/info/resque'
,
as:
'resque'
mount
Resque
::
Server
=>
'/info/resque'
,
as:
'resque'
# Enable Grack support
mount
Grack
::
Bundle
.
new
({
...
...
@@ -43,19 +43,19 @@ Gitlab::Application.routes.draw do
put
:unblock
end
end
resources
:projects
,
:constraints
=>
{
:id
=>
/[^\/]+/
}
do
resources
:projects
,
constraints:
{
id:
/[^\/]+/
}
do
member
do
get
:team
put
:team_update
end
end
resources
:team_members
,
:only
=>
[
:edit
,
:update
,
:destroy
]
resources
:hooks
,
:only
=>
[
:index
,
:create
,
:destroy
]
do
resources
:team_members
,
only:
[
:edit
,
:update
,
:destroy
]
resources
:hooks
,
only:
[
:index
,
:create
,
:destroy
]
do
get
:test
end
resource
:logs
resource
:resque
,
:controller
=>
'resque'
root
:to
=>
"dashboard#index"
resource
:logs
,
only:
[
:show
]
resource
:resque
,
controller:
'resque'
,
only:
[
:show
]
root
to:
"dashboard#index"
end
get
"errors/githost"
...
...
@@ -63,39 +63,39 @@ Gitlab::Application.routes.draw do
#
# Profile Area
#
get
"profile/account"
,
:to
=>
"profile#account"
get
"profile/history"
,
:to
=>
"profile#history"
put
"profile/password"
,
:to
=>
"profile#password_update"
get
"profile/token"
,
:to
=>
"profile#token"
put
"profile/reset_private_token"
,
:to
=>
"profile#reset_private_token"
get
"profile"
,
:to
=>
"profile#show"
get
"profile/design"
,
:to
=>
"profile#design"
put
"profile/update"
,
:to
=>
"profile#update"
get
"profile/account"
=>
"profile#account"
get
"profile/history"
=>
"profile#history"
put
"profile/password"
=>
"profile#password_update"
get
"profile/token"
=>
"profile#token"
put
"profile/reset_private_token"
=>
"profile#reset_private_token"
get
"profile"
=>
"profile#show"
get
"profile/design"
=>
"profile#design"
put
"profile/update"
=>
"profile#update"
resources
:keys
#
# Dashboard Area
#
get
"dashboard"
,
:to
=>
"dashboard#index"
get
"dashboard/issues"
,
:to
=>
"dashboard#issues"
get
"dashboard/merge_requests"
,
:to
=>
"dashboard#merge_requests"
get
"dashboard"
=>
"dashboard#index"
get
"dashboard/issues"
=>
"dashboard#issues"
get
"dashboard/merge_requests"
=>
"dashboard#merge_requests"
resources
:projects
,
:constraints
=>
{
:id
=>
/[^\/]+/
},
:only
=>
[
:new
,
:create
]
resources
:projects
,
constraints:
{
id:
/[^\/]+/
},
only:
[
:new
,
:create
]
devise_for
:users
,
:controllers
=>
{
:omniauth_callbacks
=>
:omniauth_callbacks
}
devise_for
:users
,
controllers:
{
omniauth_callbacks:
:omniauth_callbacks
}
#
# Project Area
#
resources
:projects
,
:constraints
=>
{
:id
=>
/[^\/]+/
},
:except
=>
[
:new
,
:create
,
:index
],
:path
=>
"/"
do
resources
:projects
,
constraints:
{
id:
/[^\/]+/
},
except:
[
:new
,
:create
,
:index
],
path:
"/"
do
member
do
get
"team"
get
"wall"
get
"graph"
get
"files"
end
resources
:wikis
,
:only
=>
[
:show
,
:edit
,
:destroy
,
:create
]
do
resources
:wikis
,
only:
[
:show
,
:edit
,
:destroy
,
:create
]
do
collection
do
get
:pages
end
...
...
@@ -114,46 +114,45 @@ Gitlab::Application.routes.draw do
end
resources
:deploy_keys
resources
:protected_branches
,
:only
=>
[
:index
,
:create
,
:destroy
]
resources
:protected_branches
,
only:
[
:index
,
:create
,
:destroy
]
resources
:refs
,
:only
=>
[],
:path
=>
"/"
do
resources
:refs
,
only:
[],
path:
"/"
do
collection
do
get
"switch"
end
member
do
get
"tree"
,
:constraints
=>
{
:id
=>
/[a-zA-Z.\/0-9_\-]+/
}
get
"logs_tree"
,
:constraints
=>
{
:id
=>
/[a-zA-Z.\/0-9_\-]+/
}
get
"tree"
,
constraints:
{
id:
/[a-zA-Z.\/0-9_\-]+/
}
get
"logs_tree"
,
constraints:
{
id:
/[a-zA-Z.\/0-9_\-]+/
}
get
"blob"
,
:constraints
=>
{
:id
=>
/[a-zA-Z.0-9\/_\-]+/
,
:path
=>
/.*/
constraints:
{
id:
/[a-zA-Z.0-9\/_\-]+/
,
path:
/.*/
}
# tree viewer
get
"tree/:path"
=>
"refs#tree"
,
:as
=>
:tree_file
,
:constraints
=>
{
:id
=>
/[a-zA-Z.0-9\/_\-]+/
,
:path
=>
/.*/
as:
:tree_file
,
constraints:
{
id:
/[a-zA-Z.0-9\/_\-]+/
,
path:
/.*/
}
# tree viewer
get
"logs_tree/:path"
=>
"refs#logs_tree"
,
:as
=>
:logs_file
,
:constraints
=>
{
:id
=>
/[a-zA-Z.0-9\/_\-]+/
,
:path
=>
/.*/
as:
:logs_file
,
constraints:
{
id:
/[a-zA-Z.0-9\/_\-]+/
,
path:
/.*/
}
# blame
get
"blame/:path"
=>
"refs#blame"
,
:as
=>
:blame_file
,
:constraints
=>
{
:id
=>
/[a-zA-Z.0-9\/_\-]+/
,
:path
=>
/.*/
as:
:blame_file
,
constraints:
{
id:
/[a-zA-Z.0-9\/_\-]+/
,
path:
/.*/
}
end
end
...
...
@@ -178,7 +177,7 @@ Gitlab::Application.routes.draw do
end
end
resources
:hooks
,
:only
=>
[
:index
,
:create
,
:destroy
]
do
resources
:hooks
,
only:
[
:index
,
:create
,
:destroy
]
do
member
do
get
:test
end
...
...
@@ -192,9 +191,10 @@ Gitlab::Application.routes.draw do
get
:patch
end
end
resources
:team
,
controller:
'team_members'
,
only:
[
:index
]
resources
:team_members
resources
:milestones
resources
:labels
,
:only
=>
[
:index
]
resources
:labels
,
only:
[
:index
]
resources
:issues
do
collection
do
...
...
@@ -203,11 +203,12 @@ Gitlab::Application.routes.draw do
get
:search
end
end
resources
:notes
,
:only
=>
[
:index
,
:create
,
:destroy
]
do
resources
:notes
,
only:
[
:index
,
:create
,
:destroy
]
do
collection
do
post
:preview
end
end
end
root
:to
=>
"dashboard#index"
root
to:
"dashboard#index"
end
features/steps/shared/paths.rb
View file @
b6c6a5b1
...
...
@@ -98,7 +98,7 @@ module SharedPaths
end
Then
'I visit project "Shop" team page'
do
visit
team_project
_path
(
Project
.
find_by_name
(
"Shop"
))
visit
project_team_index
_path
(
Project
.
find_by_name
(
"Shop"
))
end
Then
'I visit project "Shop" wall page'
do
...
...
lib/api/helpers.rb
View file @
b6c6a5b1
...
...
@@ -28,6 +28,14 @@ module Gitlab
end
end
def
attributes_for_keys
(
keys
)
attrs
=
{}
keys
.
each
do
|
key
|
attrs
[
key
]
=
params
[
key
]
if
params
[
key
].
present?
end
attrs
end
# error helpers
def
forbidden!
...
...
lib/api/issues.rb
View file @
b6c6a5b1
...
...
@@ -48,15 +48,10 @@ module Gitlab
# Example Request:
# POST /projects/:id/issues
post
":id/issues"
do
@issue
=
user_project
.
issues
.
new
(
title:
params
[
:title
],
description:
params
[
:description
],
assignee_id:
params
[
:assignee_id
],
milestone_id:
params
[
:milestone_id
],
label_list:
params
[
:labels
]
)
attrs
=
attributes_for_keys
[
:title
,
:description
,
:assignee_id
,
:milestone_id
]
attrs
[
:label_list
]
=
params
[
:labels
]
if
params
[
:labels
].
present?
@issue
=
user_project
.
issues
.
new
attrs
@issue
.
author
=
current_user
if
@issue
.
save
present
@issue
,
with:
Entities
::
Issue
else
...
...
@@ -81,16 +76,9 @@ module Gitlab
@issue
=
user_project
.
issues
.
find
(
params
[
:issue_id
])
authorize!
:modify_issue
,
@issue
parameters
=
{
title:
(
params
[
:title
]
||
@issue
.
title
),
description:
(
params
[
:description
]
||
@issue
.
description
),
assignee_id:
(
params
[
:assignee_id
]
||
@issue
.
assignee_id
),
milestone_id:
(
params
[
:milestone_id
]
||
@issue
.
milestone_id
),
label_list:
(
params
[
:labels
]
||
@issue
.
label_list
),
closed:
(
params
[
:closed
]
||
@issue
.
closed
)
}
if
@issue
.
update_attributes
(
parameters
)
attrs
=
attributes_for_keys
[
:title
,
:description
,
:assignee_id
,
:milestone_id
,
:closed
]
attrs
[
:label_list
]
=
params
[
:labels
]
if
params
[
:labels
].
present?
if
@issue
.
update_attributes
attrs
present
@issue
,
with:
Entities
::
Issue
else
not_found!
...
...
lib/api/milestones.rb
View file @
b6c6a5b1
...
...
@@ -36,12 +36,8 @@ module Gitlab
# Example Request:
# POST /projects/:id/milestones
post
":id/milestones"
do
@milestone
=
user_project
.
milestones
.
new
(
title:
params
[
:title
],
description:
params
[
:description
],
due_date:
params
[
:due_date
]
)
attrs
=
attributes_for_keys
[
:title
,
:description
,
:due_date
]
@milestone
=
user_project
.
milestones
.
new
attrs
if
@milestone
.
save
present
@milestone
,
with:
Entities
::
Milestone
else
...
...
@@ -64,14 +60,8 @@ module Gitlab
authorize!
:admin_milestone
,
user_project
@milestone
=
user_project
.
milestones
.
find
(
params
[
:milestone_id
])
parameters
=
{
title:
(
params
[
:title
]
||
@milestone
.
title
),
description:
(
params
[
:description
]
||
@milestone
.
description
),
due_date:
(
params
[
:due_date
]
||
@milestone
.
due_date
),
closed:
(
params
[
:closed
]
||
@milestone
.
closed
)
}
if
@milestone
.
update_attributes
(
parameters
)
attrs
=
attributes_for_keys
[
:title
,
:description
,
:due_date
,
:closed
]
if
@milestone
.
update_attributes
attrs
present
@milestone
,
with:
Entities
::
Milestone
else
not_found!
...
...
lib/api/projects.rb
View file @
b6c6a5b1
...
...
@@ -40,13 +40,16 @@ module Gitlab
post
do
params
[
:code
]
||=
params
[
:name
]
params
[
:path
]
||=
params
[
:name
]
project_attrs
=
{}
params
.
each_pair
do
|
k
,
v
|
if
Project
.
attribute_names
.
include?
k
project_attrs
[
k
]
=
v
end
end
@project
=
Project
.
create_by_user
(
project_attrs
,
current_user
)
attrs
=
attributes_for_keys
[
:code
,
:path
,
:name
,
:description
,
:default_branch
,
:issues_enabled
,
:wall_enabled
,
:merge_requests_enabled
,
:wiki_enabled
]
@project
=
Project
.
create_by_user
(
attrs
,
current_user
)
if
@project
.
saved?
present
@project
,
with:
Entities
::
Project
else
...
...
@@ -204,12 +207,10 @@ module Gitlab
# Example Request:
# POST /projects/:id/snippets
post
":id/snippets"
do
@snippet
=
user_project
.
snippets
.
new
(
title:
params
[
:title
],
file_name:
params
[
:file_name
],
expires_at:
params
[
:lifetime
],
content:
params
[
:code
]
)
attrs
=
attributes_for_keys
[
:title
,
:file_name
]
attrs
[
:expires_at
]
=
params
[
:lifetime
]
if
params
[
:lifetime
].
present?
attrs
[
:content
]
=
params
[
:code
]
if
params
[
:code
].
present?
@snippet
=
user_project
.
snippets
.
new
attrs
@snippet
.
author
=
current_user
if
@snippet
.
save
...
...
@@ -234,14 +235,11 @@ module Gitlab
@snippet
=
user_project
.
snippets
.
find
(
params
[
:snippet_id
])
authorize!
:modify_snippet
,
@snippet
parameters
=
{
title:
(
params
[
:title
]
||
@snippet
.
title
),
file_name:
(
params
[
:file_name
]
||
@snippet
.
file_name
),
expires_at:
(
params
[
:lifetime
]
||
@snippet
.
expires_at
),
content:
(
params
[
:code
]
||
@snippet
.
content
)
}
attrs
=
attributes_for_keys
[
:title
,
:file_name
]
attrs
[
:expires_at
]
=
params
[
:lifetime
]
if
params
[
:lifetime
].
present?
attrs
[
:content
]
=
params
[
:code
]
if
params
[
:code
].
present?
if
@snippet
.
update_attributes
(
parameters
)
if
@snippet
.
update_attributes
attrs
present
@snippet
,
with:
Entities
::
ProjectSnippet
else
not_found!
...
...
spec/requests/security/project_access_spec.rb
View file @
b6c6a5b1
...
...
@@ -70,7 +70,7 @@ describe "Application access" do
end
describe
"GET /project_code/team"
do
subject
{
team_project
_path
(
@project
)
}
subject
{
project_team_index
_path
(
@project
)
}
it
{
should
be_allowed_for
@u1
}
it
{
should
be_allowed_for
@u3
}
...
...
spec/routing/admin_routing_spec.rb
0 → 100644
View file @
b6c6a5b1
require
'spec_helper'
# team_update_admin_user PUT /admin/users/:id/team_update(.:format) admin/users#team_update
# block_admin_user PUT /admin/users/:id/block(.:format) admin/users#block
# unblock_admin_user PUT /admin/users/:id/unblock(.:format) admin/users#unblock
# admin_users GET /admin/users(.:format) admin/users#index
# POST /admin/users(.:format) admin/users#create
# new_admin_user GET /admin/users/new(.:format) admin/users#new
# edit_admin_user GET /admin/users/:id/edit(.:format) admin/users#edit
# admin_user GET /admin/users/:id(.:format) admin/users#show
# PUT /admin/users/:id(.:format) admin/users#update
# DELETE /admin/users/:id(.:format) admin/users#destroy
describe
Admin
::
UsersController
,
"routing"
do
it
"to #team_update"
do
put
(
"/admin/users/1/team_update"
).
should
route_to
(
'admin/users#team_update'
,
id:
'1'
)
end
it
"to #block"
do
put
(
"/admin/users/1/block"
).
should
route_to
(
'admin/users#block'
,
id:
'1'
)
end
it
"to #unblock"
do
put
(
"/admin/users/1/unblock"
).
should
route_to
(
'admin/users#unblock'
,
id:
'1'
)
end
it
"to #index"
do
get
(
"/admin/users"
).
should
route_to
(
'admin/users#index'
)
end
it
"to #show"
do
get
(
"/admin/users/1"
).
should
route_to
(
'admin/users#show'
,
id:
'1'
)
end
it
"to #create"
do
post
(
"/admin/users"
).
should
route_to
(
'admin/users#create'
)
end
it
"to #new"
do
get
(
"/admin/users/new"
).
should
route_to
(
'admin/users#new'
)
end
it
"to #edit"
do
get
(
"/admin/users/1/edit"
).
should
route_to
(
'admin/users#edit'
,
id:
'1'
)
end
it
"to #show"
do
get
(
"/admin/users/1"
).
should
route_to
(
'admin/users#show'
,
id:
'1'
)
end
it
"to #update"
do
put
(
"/admin/users/1"
).
should
route_to
(
'admin/users#update'
,
id:
'1'
)
end
it
"to #destroy"
do
delete
(
"/admin/users/1"
).
should
route_to
(
'admin/users#destroy'
,
id:
'1'
)
end
end
# team_admin_project GET /admin/projects/:id/team(.:format) admin/projects#team {:id=>/[^\/]+/}
# team_update_admin_project PUT /admin/projects/:id/team_update(.:format) admin/projects#team_update {:id=>/[^\/]+/}
# admin_projects GET /admin/projects(.:format) admin/projects#index {:id=>/[^\/]+/}
# POST /admin/projects(.:format) admin/projects#create {:id=>/[^\/]+/}
# new_admin_project GET /admin/projects/new(.:format) admin/projects#new {:id=>/[^\/]+/}
# edit_admin_project GET /admin/projects/:id/edit(.:format) admin/projects#edit {:id=>/[^\/]+/}
# admin_project GET /admin/projects/:id(.:format) admin/projects#show {:id=>/[^\/]+/}
# PUT /admin/projects/:id(.:format) admin/projects#update {:id=>/[^\/]+/}
# DELETE /admin/projects/:id(.:format) admin/projects#destroy {:id=>/[^\/]+/}
describe
Admin
::
ProjectsController
,
"routing"
do
it
"to #team"
do
get
(
"/admin/projects/gitlab/team"
).
should
route_to
(
'admin/projects#team'
,
id:
'gitlab'
)
end
it
"to #team_update"
do
put
(
"/admin/projects/gitlab/team_update"
).
should
route_to
(
'admin/projects#team_update'
,
id:
'gitlab'
)
end
it
"to #index"
do
get
(
"/admin/projects"
).
should
route_to
(
'admin/projects#index'
)
end
it
"to #create"
do
post
(
"/admin/projects"
).
should
route_to
(
'admin/projects#create'
)
end
it
"to #new"
do
get
(
"/admin/projects/new"
).
should
route_to
(
'admin/projects#new'
)
end
it
"to #edit"
do
get
(
"/admin/projects/gitlab/edit"
).
should
route_to
(
'admin/projects#edit'
,
id:
'gitlab'
)
end
it
"to #show"
do
get
(
"/admin/projects/gitlab"
).
should
route_to
(
'admin/projects#show'
,
id:
'gitlab'
)
end
it
"to #update"
do
put
(
"/admin/projects/gitlab"
).
should
route_to
(
'admin/projects#update'
,
id:
'gitlab'
)
end
it
"to #destroy"
do
delete
(
"/admin/projects/gitlab"
).
should
route_to
(
'admin/projects#destroy'
,
id:
'gitlab'
)
end
end
# edit_admin_team_member GET /admin/team_members/:id/edit(.:format) admin/team_members#edit
# admin_team_member PUT /admin/team_members/:id(.:format) admin/team_members#update
# DELETE /admin/team_members/:id(.:format) admin/team_members#destroy
describe
Admin
::
TeamMembersController
,
"routing"
do
it
"to #edit"
do
get
(
"/admin/team_members/1/edit"
).
should
route_to
(
'admin/team_members#edit'
,
id:
'1'
)
end
it
"to #update"
do
put
(
"/admin/team_members/1"
).
should
route_to
(
'admin/team_members#update'
,
id:
'1'
)
end
it
"to #destroy"
do
delete
(
"/admin/team_members/1"
).
should
route_to
(
'admin/team_members#destroy'
,
id:
'1'
)
end
end
# admin_hook_test GET /admin/hooks/:hook_id/test(.:format) admin/hooks#test
# admin_hooks GET /admin/hooks(.:format) admin/hooks#index
# POST /admin/hooks(.:format) admin/hooks#create
# admin_hook DELETE /admin/hooks/:id(.:format) admin/hooks#destroy
describe
Admin
::
HooksController
,
"routing"
do
it
"to #test"
do
get
(
"/admin/hooks/1/test"
).
should
route_to
(
'admin/hooks#test'
,
hook_id:
'1'
)
end
it
"to #index"
do
get
(
"/admin/hooks"
).
should
route_to
(
'admin/hooks#index'
)
end
it
"to #create"
do
post
(
"/admin/hooks"
).
should
route_to
(
'admin/hooks#create'
)
end
it
"to #destroy"
do
delete
(
"/admin/hooks/1"
).
should
route_to
(
'admin/hooks#destroy'
,
id:
'1'
)
end
end
# admin_logs GET /admin/logs(.:format) admin/logs#show
describe
Admin
::
LogsController
,
"routing"
do
it
"to #show"
do
get
(
"/admin/logs"
).
should
route_to
(
'admin/logs#show'
)
end
end
# admin_resque GET /admin/resque(.:format) admin/resque#show
describe
Admin
::
ResqueController
,
"routing"
do
it
"to #show"
do
get
(
"/admin/resque"
).
should
route_to
(
'admin/resque#show'
)
end
end
# admin_root /admin(.:format) admin/dashboard#index
describe
Admin
::
DashboardController
,
"routing"
do
it
"to #index"
do
get
(
"/admin"
).
should
route_to
(
'admin/dashboard#index'
)
end
end
spec/routing/project_routing_spec.rb
0 → 100644
View file @
b6c6a5b1
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
# it_behaves_like "RESTful project resources" do
# let(:controller) { 'issues' }
# end
#
# # Customizing actions
# it_behaves_like "RESTful project resources" do
# let(:actions) { [:index] }
# let(:controller) { 'issues' }
# end
shared_examples
"RESTful project resources"
do
let
(
:actions
)
{
[
:index
,
:create
,
:new
,
:edit
,
:show
,
:update
,
:destroy
]
}
it
"to #index"
do
get
(
"/gitlabhq/
#{
controller
}
"
).
should
route_to
(
"
#{
controller
}
#index"
,
project_id:
'gitlabhq'
)
if
actions
.
include?
(
:index
)
end
it
"to #create"
do
post
(
"/gitlabhq/
#{
controller
}
"
).
should
route_to
(
"
#{
controller
}
#create"
,
project_id:
'gitlabhq'
)
if
actions
.
include?
(
:create
)
end
it
"to #new"
do
get
(
"/gitlabhq/
#{
controller
}
/new"
).
should
route_to
(
"
#{
controller
}
#new"
,
project_id:
'gitlabhq'
)
if
actions
.
include?
(
:new
)
end
it
"to #edit"
do
get
(
"/gitlabhq/
#{
controller
}
/1/edit"
).
should
route_to
(
"
#{
controller
}
#edit"
,
project_id:
'gitlabhq'
,
id:
'1'
)
if
actions
.
include?
(
:edit
)
end
it
"to #show"
do
get
(
"/gitlabhq/
#{
controller
}
/1"
).
should
route_to
(
"
#{
controller
}
#show"
,
project_id:
'gitlabhq'
,
id:
'1'
)
if
actions
.
include?
(
:show
)
end
it
"to #update"
do
put
(
"/gitlabhq/
#{
controller
}
/1"
).
should
route_to
(
"
#{
controller
}
#update"
,
project_id:
'gitlabhq'
,
id:
'1'
)
if
actions
.
include?
(
:update
)
end
it
"to #destroy"
do
delete
(
"/gitlabhq/
#{
controller
}
/1"
).
should
route_to
(
"
#{
controller
}
#destroy"
,
project_id:
'gitlabhq'
,
id:
'1'
)
if
actions
.
include?
(
:destroy
)
end
end
# projects POST /projects(.:format) projects#create
# new_project GET /projects/new(.:format) projects#new
# wall_project GET /:id/wall(.:format) projects#wall
# graph_project GET /:id/graph(.:format) projects#graph
# 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
describe
ProjectsController
,
"routing"
do
it
"to #create"
do
post
(
"/projects"
).
should
route_to
(
'projects#create'
)
end
it
"to #new"
do
get
(
"/projects/new"
).
should
route_to
(
'projects#new'
)
end
it
"to #wall"
do
get
(
"/gitlabhq/wall"
).
should
route_to
(
'projects#wall'
,
id:
'gitlabhq'
)
end
it
"to #graph"
do
get
(
"/gitlabhq/graph"
).
should
route_to
(
'projects#graph'
,
id:
'gitlabhq'
)
end
it
"to #files"
do
get
(
"/gitlabhq/files"
).
should
route_to
(
'projects#files'
,
id:
'gitlabhq'
)
end
it
"to #edit"
do
get
(
"/gitlabhq/edit"
).
should
route_to
(
'projects#edit'
,
id:
'gitlabhq'
)
end
it
"to #show"
do
get
(
"/gitlabhq"
).
should
route_to
(
'projects#show'
,
id:
'gitlabhq'
)
end
it
"to #update"
do
put
(
"/gitlabhq"
).
should
route_to
(
'projects#update'
,
id:
'gitlabhq'
)
end
it
"to #destroy"
do
delete
(
"/gitlabhq"
).
should
route_to
(
'projects#destroy'
,
id:
'gitlabhq'
)
end
end
# pages_project_wikis GET /:project_id/wikis/pages(.:format) wikis#pages
# history_project_wiki GET /:project_id/wikis/:id/history(.:format) wikis#history
# project_wikis POST /:project_id/wikis(.:format) wikis#create
# edit_project_wiki GET /:project_id/wikis/:id/edit(.:format) wikis#edit
# project_wiki GET /:project_id/wikis/:id(.:format) wikis#show
# DELETE /:project_id/wikis/:id(.:format) wikis#destroy
describe
WikisController
,
"routing"
do
it
"to #pages"
do
get
(
"/gitlabhq/wikis/pages"
).
should
route_to
(
'wikis#pages'
,
project_id:
'gitlabhq'
)
end
it
"to #history"
do
get
(
"/gitlabhq/wikis/1/history"
).
should
route_to
(
'wikis#history'
,
project_id:
'gitlabhq'
,
id:
'1'
)
end
it_behaves_like
"RESTful project resources"
do
let
(
:actions
)
{
[
:create
,
:edit
,
:show
,
:destroy
]
}
let
(
:controller
)
{
'wikis'
}
end
end
# branches_project_repository GET /:project_id/repository/branches(.:format) repositories#branches
# tags_project_repository GET /:project_id/repository/tags(.:format) repositories#tags
# archive_project_repository GET /:project_id/repository/archive(.:format) repositories#archive
# project_repository POST /:project_id/repository(.:format) repositories#create
# new_project_repository GET /:project_id/repository/new(.:format) repositories#new
# edit_project_repository GET /:project_id/repository/edit(.:format) repositories#edit
# GET /:project_id/repository(.:format) repositories#show
# PUT /:project_id/repository(.:format) repositories#update
# DELETE /:project_id/repository(.:format) repositories#destroy
describe
RepositoriesController
,
"routing"
do
it
"to #branches"
do
get
(
"/gitlabhq/repository/branches"
).
should
route_to
(
'repositories#branches'
,
project_id:
'gitlabhq'
)
end
it
"to #tags"
do
get
(
"/gitlabhq/repository/tags"
).
should
route_to
(
'repositories#tags'
,
project_id:
'gitlabhq'
)
end
it
"to #archive"
do
get
(
"/gitlabhq/repository/archive"
).
should
route_to
(
'repositories#archive'
,
project_id:
'gitlabhq'
)
end
it
"to #create"
do
post
(
"/gitlabhq/repository"
).
should
route_to
(
'repositories#create'
,
project_id:
'gitlabhq'
)
end
it
"to #new"
do
get
(
"/gitlabhq/repository/new"
).
should
route_to
(
'repositories#new'
,
project_id:
'gitlabhq'
)
end
it
"to #edit"
do
get
(
"/gitlabhq/repository/edit"
).
should
route_to
(
'repositories#edit'
,
project_id:
'gitlabhq'
)
end
it
"to #show"
do
get
(
"/gitlabhq/repository"
).
should
route_to
(
'repositories#show'
,
project_id:
'gitlabhq'
)
end
it
"to #update"
do
put
(
"/gitlabhq/repository"
).
should
route_to
(
'repositories#update'
,
project_id:
'gitlabhq'
)
end
it
"to #destroy"
do
delete
(
"/gitlabhq/repository"
).
should
route_to
(
'repositories#destroy'
,
project_id:
'gitlabhq'
)
end
end
# 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
# edit_project_deploy_key GET /:project_id/deploy_keys/:id/edit(.:format) deploy_keys#edit
# project_deploy_key GET /:project_id/deploy_keys/:id(.:format) deploy_keys#show
# PUT /:project_id/deploy_keys/:id(.:format) deploy_keys#update
# DELETE /:project_id/deploy_keys/:id(.:format) deploy_keys#destroy
describe
DeployKeysController
,
"routing"
do
it_behaves_like
"RESTful project resources"
do
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
describe
ProtectedBranchesController
,
"routing"
do
it_behaves_like
"RESTful project resources"
do
let
(
:actions
)
{
[
:index
,
:create
,
:destroy
]
}
let
(
:controller
)
{
'protected_branches'
}
end
end
# switch_project_refs GET /:project_id/switch(.:format) refs#switch
# tree_project_ref GET /:project_id/:id/tree(.:format) refs#tree
# logs_tree_project_ref GET /:project_id/:id/logs_tree(.:format) refs#logs_tree
# blob_project_ref GET /:project_id/:id/blob(.:format) refs#blob
# tree_file_project_ref GET /:project_id/:id/tree/:path(.:format) refs#tree
# logs_file_project_ref GET /:project_id/:id/logs_tree/:path(.:format) refs#logs_tree
# blame_file_project_ref GET /:project_id/:id/blame/:path(.:format) refs#blame
describe
RefsController
,
"routing"
do
it
"to #switch"
do
get
(
"/gitlabhq/switch"
).
should
route_to
(
'refs#switch'
,
project_id:
'gitlabhq'
)
end
it
"to #tree"
do
get
(
"/gitlabhq/stable/tree"
).
should
route_to
(
'refs#tree'
,
project_id:
'gitlabhq'
,
id:
'stable'
)
get
(
"/gitlabhq/stable/tree/foo/bar/baz"
).
should
route_to
(
'refs#tree'
,
project_id:
'gitlabhq'
,
id:
'stable'
,
path:
'foo/bar/baz'
)
end
it
"to #logs_tree"
do
get
(
"/gitlabhq/stable/logs_tree"
).
should
route_to
(
'refs#logs_tree'
,
project_id:
'gitlabhq'
,
id:
'stable'
)
get
(
"/gitlabhq/stable/logs_tree/foo/bar/baz"
).
should
route_to
(
'refs#logs_tree'
,
project_id:
'gitlabhq'
,
id:
'stable'
,
path:
'foo/bar/baz'
)
end
it
"to #blob"
do
get
(
"/gitlabhq/stable/blob"
).
should
route_to
(
'refs#blob'
,
project_id:
'gitlabhq'
,
id:
'stable'
)
end
it
"to #blame"
do
get
(
"/gitlabhq/stable/blame/foo/bar/baz"
).
should
route_to
(
'refs#blame'
,
project_id:
'gitlabhq'
,
id:
'stable'
,
path:
'foo/bar/baz'
)
end
end
# diffs_project_merge_request GET /:project_id/merge_requests/:id/diffs(.:format) merge_requests#diffs
# automerge_project_merge_request GET /:project_id/merge_requests/:id/automerge(.:format) merge_requests#automerge
# automerge_check_project_merge_request GET /:project_id/merge_requests/:id/automerge_check(.:format) merge_requests#automerge_check
# raw_project_merge_request GET /:project_id/merge_requests/:id/raw(.:format) merge_requests#raw
# branch_from_project_merge_requests GET /:project_id/merge_requests/branch_from(.:format) merge_requests#branch_from
# branch_to_project_merge_requests GET /:project_id/merge_requests/branch_to(.:format) merge_requests#branch_to
# project_merge_requests GET /:project_id/merge_requests(.:format) merge_requests#index
# POST /:project_id/merge_requests(.:format) merge_requests#create
# new_project_merge_request GET /:project_id/merge_requests/new(.:format) merge_requests#new
# edit_project_merge_request GET /:project_id/merge_requests/:id/edit(.:format) merge_requests#edit
# project_merge_request GET /:project_id/merge_requests/:id(.:format) merge_requests#show
# PUT /:project_id/merge_requests/:id(.:format) merge_requests#update
# DELETE /:project_id/merge_requests/:id(.:format) merge_requests#destroy
describe
MergeRequestsController
,
"routing"
do
it
"to #diffs"
do
get
(
"/gitlabhq/merge_requests/1/diffs"
).
should
route_to
(
'merge_requests#diffs'
,
project_id:
'gitlabhq'
,
id:
'1'
)
end
it
"to #automerge"
do
get
(
"/gitlabhq/merge_requests/1/automerge"
).
should
route_to
(
'merge_requests#automerge'
,
project_id:
'gitlabhq'
,
id:
'1'
)
end
it
"to #automerge_check"
do
get
(
"/gitlabhq/merge_requests/1/automerge_check"
).
should
route_to
(
'merge_requests#automerge_check'
,
project_id:
'gitlabhq'
,
id:
'1'
)
end
it
"to #raw"
do
get
(
"/gitlabhq/merge_requests/1/raw"
).
should
route_to
(
'merge_requests#raw'
,
project_id:
'gitlabhq'
,
id:
'1'
)
end
it
"to #branch_from"
do
get
(
"/gitlabhq/merge_requests/branch_from"
).
should
route_to
(
'merge_requests#branch_from'
,
project_id:
'gitlabhq'
)
end
it
"to #branch_to"
do
get
(
"/gitlabhq/merge_requests/branch_to"
).
should
route_to
(
'merge_requests#branch_to'
,
project_id:
'gitlabhq'
)
end
it_behaves_like
"RESTful project resources"
do
let
(
:controller
)
{
'merge_requests'
}
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
describe
SnippetsController
,
"routing"
do
it
"to #raw"
do
get
(
"/gitlabhq/snippets/1/raw"
).
should
route_to
(
'snippets#raw'
,
project_id:
'gitlabhq'
,
id:
'1'
)
end
it_behaves_like
"RESTful project resources"
do
let
(
:controller
)
{
'snippets'
}
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
describe
HooksController
,
"routing"
do
it
"to #test"
do
get
(
"/gitlabhq/hooks/1/test"
).
should
route_to
(
'hooks#test'
,
project_id:
'gitlabhq'
,
id:
'1'
)
end
it_behaves_like
"RESTful project resources"
do
let
(
:actions
)
{
[
:index
,
:create
,
:destroy
]
}
let
(
:controller
)
{
'hooks'
}
end
end
# compare_project_commits GET /:project_id/commits/compare(.:format) commits#compare
# 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
# new_project_commit GET /:project_id/commits/new(.:format) commits#new
# edit_project_commit GET /:project_id/commits/:id/edit(.:format) commits#edit
# project_commit GET /:project_id/commits/:id(.:format) commits#show
# PUT /:project_id/commits/:id(.:format) commits#update
# DELETE /:project_id/commits/:id(.:format) commits#destroy
describe
CommitsController
,
"routing"
do
it
"to #compare"
do
get
(
"/gitlabhq/commits/compare"
).
should
route_to
(
'commits#compare'
,
project_id:
'gitlabhq'
)
end
it
"to #patch"
do
get
(
"/gitlabhq/commits/1/patch"
).
should
route_to
(
'commits#patch'
,
project_id:
'gitlabhq'
,
id:
'1'
)
end
it_behaves_like
"RESTful project resources"
do
let
(
:controller
)
{
'commits'
}
end
end
# project_team_members GET /:project_id/team_members(.:format) team_members#index
# POST /:project_id/team_members(.:format) team_members#create
# new_project_team_member GET /:project_id/team_members/new(.:format) team_members#new
# edit_project_team_member GET /:project_id/team_members/:id/edit(.:format) team_members#edit
# project_team_member GET /:project_id/team_members/:id(.:format) team_members#show
# PUT /:project_id/team_members/:id(.:format) team_members#update
# DELETE /:project_id/team_members/:id(.:format) team_members#destroy
describe
TeamMembersController
,
"routing"
do
it_behaves_like
"RESTful project resources"
do
let
(
:controller
)
{
'team_members'
}
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
describe
MilestonesController
,
"routing"
do
it_behaves_like
"RESTful project resources"
do
let
(
:controller
)
{
'milestones'
}
end
end
# project_labels GET /:project_id/labels(.:format) labels#index
describe
LabelsController
,
"routing"
do
it
"to #index"
do
get
(
"/gitlabhq/labels"
).
should
route_to
(
'labels#index'
,
project_id:
'gitlabhq'
)
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
describe
IssuesController
,
"routing"
do
it
"to #sort"
do
post
(
"/gitlabhq/issues/sort"
).
should
route_to
(
'issues#sort'
,
project_id:
'gitlabhq'
)
end
it
"to #bulk_update"
do
post
(
"/gitlabhq/issues/bulk_update"
).
should
route_to
(
'issues#bulk_update'
,
project_id:
'gitlabhq'
)
end
it
"to #search"
do
get
(
"/gitlabhq/issues/search"
).
should
route_to
(
'issues#search'
,
project_id:
'gitlabhq'
)
end
it_behaves_like
"RESTful project resources"
do
let
(
:controller
)
{
'issues'
}
end
end
# preview_project_notes POST /:project_id/notes/preview(.:format) notes#preview
# 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
describe
NotesController
,
"routing"
do
it
"to #preview"
do
post
(
"/gitlabhq/notes/preview"
).
should
route_to
(
'notes#preview'
,
project_id:
'gitlabhq'
)
end
it_behaves_like
"RESTful project resources"
do
let
(
:actions
)
{
[
:index
,
:create
,
:destroy
]
}
let
(
:controller
)
{
'notes'
}
end
end
spec/routing/routing_spec.rb
0 → 100644
View file @
b6c6a5b1
require
'spec_helper'
# search GET /search(.:format) search#show
describe
SearchController
,
"routing"
do
it
"to #show"
do
get
(
"/search"
).
should
route_to
(
'search#show'
)
end
end
# gitlab_api /api Gitlab::API
# resque /info/resque Resque::Server
# /:path Grack
describe
"Mounted Apps"
,
"routing"
do
it
"to API"
do
get
(
"/api"
).
should
be_routable
end
it
"to Resque"
do
pending
get
(
"/info/resque"
).
should
be_routable
end
it
"to Grack"
do
get
(
"/gitlabhq.git"
).
should
be_routable
end
end
# help GET /help(.:format) help#index
# help_permissions GET /help/permissions(.:format) help#permissions
# help_workflow GET /help/workflow(.:format) help#workflow
# help_api GET /help/api(.:format) help#api
# help_web_hooks GET /help/web_hooks(.:format) help#web_hooks
# help_system_hooks GET /help/system_hooks(.:format) help#system_hooks
# help_markdown GET /help/markdown(.:format) help#markdown
# help_ssh GET /help/ssh(.:format) help#ssh
describe
HelpController
,
"routing"
do
it
"to #index"
do
get
(
"/help"
).
should
route_to
(
'help#index'
)
end
it
"to #permissions"
do
get
(
"/help/permissions"
).
should
route_to
(
'help#permissions'
)
end
it
"to #workflow"
do
get
(
"/help/workflow"
).
should
route_to
(
'help#workflow'
)
end
it
"to #api"
do
get
(
"/help/api"
).
should
route_to
(
'help#api'
)
end
it
"to #web_hooks"
do
get
(
"/help/web_hooks"
).
should
route_to
(
'help#web_hooks'
)
end
it
"to #system_hooks"
do
get
(
"/help/system_hooks"
).
should
route_to
(
'help#system_hooks'
)
end
it
"to #markdown"
do
get
(
"/help/markdown"
).
should
route_to
(
'help#markdown'
)
end
it
"to #ssh"
do
get
(
"/help/ssh"
).
should
route_to
(
'help#ssh'
)
end
end
# errors_githost GET /errors/githost(.:format) errors#githost
describe
ErrorsController
,
"routing"
do
it
"to #githost"
do
get
(
"/errors/githost"
).
should
route_to
(
'errors#githost'
)
end
end
# profile_account GET /profile/account(.:format) profile#account
# profile_history GET /profile/history(.:format) profile#history
# profile_password PUT /profile/password(.:format) profile#password_update
# profile_token GET /profile/token(.:format) profile#token
# profile_reset_private_token PUT /profile/reset_private_token(.:format) profile#reset_private_token
# profile GET /profile(.:format) profile#show
# profile_design GET /profile/design(.:format) profile#design
# profile_update PUT /profile/update(.:format) profile#update
describe
ProfileController
,
"routing"
do
it
"to #account"
do
get
(
"/profile/account"
).
should
route_to
(
'profile#account'
)
end
it
"to #history"
do
get
(
"/profile/history"
).
should
route_to
(
'profile#history'
)
end
it
"to #password_update"
do
put
(
"/profile/password"
).
should
route_to
(
'profile#password_update'
)
end
it
"to #token"
do
get
(
"/profile/token"
).
should
route_to
(
'profile#token'
)
end
it
"to #reset_private_token"
do
put
(
"/profile/reset_private_token"
).
should
route_to
(
'profile#reset_private_token'
)
end
it
"to #show"
do
get
(
"/profile"
).
should
route_to
(
'profile#show'
)
end
it
"to #design"
do
get
(
"/profile/design"
).
should
route_to
(
'profile#design'
)
end
it
"to #update"
do
put
(
"/profile/update"
).
should
route_to
(
'profile#update'
)
end
end
# keys GET /keys(.:format) keys#index
# POST /keys(.:format) keys#create
# new_key GET /keys/new(.:format) keys#new
# edit_key GET /keys/:id/edit(.:format) keys#edit
# key GET /keys/:id(.:format) keys#show
# PUT /keys/:id(.:format) keys#update
# DELETE /keys/:id(.:format) keys#destroy
describe
KeysController
,
"routing"
do
it
"to #index"
do
get
(
"/keys"
).
should
route_to
(
'keys#index'
)
end
it
"to #create"
do
post
(
"/keys"
).
should
route_to
(
'keys#create'
)
end
it
"to #new"
do
get
(
"/keys/new"
).
should
route_to
(
'keys#new'
)
end
it
"to #edit"
do
get
(
"/keys/1/edit"
).
should
route_to
(
'keys#edit'
,
id:
'1'
)
end
it
"to #show"
do
get
(
"/keys/1"
).
should
route_to
(
'keys#show'
,
id:
'1'
)
end
it
"to #update"
do
put
(
"/keys/1"
).
should
route_to
(
'keys#update'
,
id:
'1'
)
end
it
"to #destroy"
do
delete
(
"/keys/1"
).
should
route_to
(
'keys#destroy'
,
id:
'1'
)
end
end
# dashboard GET /dashboard(.:format) dashboard#index
# dashboard_issues GET /dashboard/issues(.:format) dashboard#issues
# dashboard_merge_requests GET /dashboard/merge_requests(.:format) dashboard#merge_requests
# root / dashboard#index
describe
DashboardController
,
"routing"
do
it
"to #index"
do
get
(
"/dashboard"
).
should
route_to
(
'dashboard#index'
)
get
(
"/"
).
should
route_to
(
'dashboard#index'
)
end
it
"to #issues"
do
get
(
"/dashboard/issues"
).
should
route_to
(
'dashboard#issues'
)
end
it
"to #merge_requests"
do
get
(
"/dashboard/merge_requests"
).
should
route_to
(
'dashboard#merge_requests'
)
end
end
# new_user_session GET /users/sign_in(.:format) devise/sessions#new
# user_session POST /users/sign_in(.:format) devise/sessions#create
# destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
# user_omniauth_authorize /users/auth/:provider(.:format) omniauth_callbacks#passthru
# user_omniauth_callback /users/auth/:action/callback(.:format) omniauth_callbacks#(?-mix:(?!))
# user_password POST /users/password(.:format) devise/passwords#create
# new_user_password GET /users/password/new(.:format) devise/passwords#new
# edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
# PUT /users/password(.:format) devise/passwords#update
describe
"Authentication"
,
"routing"
do
# pending
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment