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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
gitlab-ce
Commits
df9cbbc9
Commit
df9cbbc9
authored
Sep 05, 2013
by
Hiroyuki Sato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop support of root namespace in routing
parent
e1ca9de0
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
129 additions
and
149 deletions
+129
-149
config/routes.rb
config/routes.rb
+12
-12
features/steps/dashboard/dashboard.rb
features/steps/dashboard/dashboard.rb
+1
-1
features/steps/group/group.rb
features/steps/group/group.rb
+1
-1
features/steps/project/project_network_graph.rb
features/steps/project/project_network_graph.rb
+0
-5
lib/api/merge_requests.rb
lib/api/merge_requests.rb
+1
-1
spec/controllers/blob_controller_spec.rb
spec/controllers/blob_controller_spec.rb
+1
-1
spec/controllers/commit_controller_spec.rb
spec/controllers/commit_controller_spec.rb
+7
-7
spec/controllers/commits_controller_spec.rb
spec/controllers/commits_controller_spec.rb
+1
-1
spec/controllers/merge_requests_controller_spec.rb
spec/controllers/merge_requests_controller_spec.rb
+7
-7
spec/controllers/tree_controller_spec.rb
spec/controllers/tree_controller_spec.rb
+1
-1
spec/factories.rb
spec/factories.rb
+1
-0
spec/features/atom/issues_spec.rb
spec/features/atom/issues_spec.rb
+1
-1
spec/models/project_spec.rb
spec/models/project_spec.rb
+2
-19
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+29
-28
spec/routing/project_routing_spec.rb
spec/routing/project_routing_spec.rb
+61
-61
spec/routing/routing_spec.rb
spec/routing/routing_spec.rb
+2
-2
spec/services/git_push_service_spec.rb
spec/services/git_push_service_spec.rb
+1
-1
No files found.
config/routes.rb
View file @
df9cbbc9
...
...
@@ -157,7 +157,7 @@ Gitlab::Application.routes.draw do
#
# Project Area
#
resources
:projects
,
constraints:
{
id:
/
(?:[a-zA-Z.0-9_\-]+\/)?
[a-zA-Z.0-9_\-]+/
},
except:
[
:new
,
:create
,
:index
],
path:
"/"
do
resources
:projects
,
constraints:
{
id:
/
[a-zA-Z.0-9_\-]+\/
[a-zA-Z.0-9_\-]+/
},
except:
[
:new
,
:create
,
:index
],
path:
"/"
do
member
do
put
:transfer
post
:fork
...
...
@@ -177,13 +177,13 @@ Gitlab::Application.routes.draw do
resources
:graphs
,
only:
[
:show
],
constraints:
{
id:
/(?:[^.]|\.(?!json$))+/
,
format:
/json/
}
match
"/compare/:from...:to"
=>
"compare#show"
,
as:
"compare"
,
via:
[
:get
,
:post
],
constraints:
{
from:
/.+/
,
to:
/.+/
}
resources
:snippets
do
resources
:snippets
,
constraints:
{
id:
/\d+/
}
do
member
do
get
"raw"
end
end
resources
:wikis
,
only:
[
:show
,
:edit
,
:destroy
,
:create
]
do
resources
:wikis
,
only:
[
:show
,
:edit
,
:destroy
,
:create
]
,
constraints:
{
id:
/[a-zA-Z.0-9_\-]+/
}
do
collection
do
get
:pages
put
':id'
=>
'wikis#update'
...
...
@@ -195,7 +195,7 @@ Gitlab::Application.routes.draw do
end
end
resource
:wall
,
only:
[
:show
]
do
resource
:wall
,
only:
[
:show
]
,
constraints:
{
id:
/\d+/
}
do
member
do
get
'notes'
end
...
...
@@ -214,21 +214,21 @@ Gitlab::Application.routes.draw do
end
end
resources
:deploy_keys
do
resources
:deploy_keys
,
constraints:
{
id:
/\d+/
}
do
member
do
put
:enable
put
:disable
end
end
resources
:branches
,
only:
[
:index
,
:new
,
:create
,
:destroy
]
do
resources
:branches
,
only:
[
:index
,
:new
,
:create
,
:destroy
]
,
constraints:
{
id:
/[a-zA-Z.\/0-9_\-#%+]+/
}
do
collection
do
get
:recent
end
end
resources
:tags
,
only:
[
:index
,
:new
,
:create
,
:destroy
]
resources
:protected_branches
,
only:
[
:index
,
:create
,
:destroy
]
resources
:tags
,
only:
[
:index
,
:new
,
:create
,
:destroy
]
,
constraints:
{
id:
/[a-zA-Z.\/0-9_\-#%+]+/
}
resources
:protected_branches
,
only:
[
:index
,
:create
,
:destroy
]
,
constraints:
{
id:
/[a-zA-Z.\/0-9_\-#%+]+/
}
resources
:refs
,
only:
[]
do
collection
do
...
...
@@ -262,14 +262,14 @@ Gitlab::Application.routes.draw do
end
end
resources
:hooks
,
only:
[
:index
,
:create
,
:destroy
]
do
resources
:hooks
,
only:
[
:index
,
:create
,
:destroy
]
,
constraints:
{
id:
/\d+/
}
do
member
do
get
:test
end
end
resources
:team
,
controller:
'team_members'
,
only:
[
:index
]
resources
:milestones
,
except:
[
:destroy
]
resources
:milestones
,
except:
[
:destroy
]
,
constraints:
{
id:
/\d+/
}
resources
:labels
,
only:
[
:index
]
do
collection
do
...
...
@@ -283,7 +283,7 @@ Gitlab::Application.routes.draw do
end
end
resources
:team_members
,
except:
[
:index
,
:edit
]
do
resources
:team_members
,
except:
[
:index
,
:edit
]
,
constraints:
{
id:
/[a-zA-Z.\/0-9_\-#%+]+/
}
do
collection
do
# Used for import team
...
...
@@ -293,7 +293,7 @@ Gitlab::Application.routes.draw do
end
end
resources
:notes
,
only:
[
:index
,
:create
,
:destroy
,
:update
]
do
resources
:notes
,
only:
[
:index
,
:create
,
:destroy
,
:update
]
,
constraints:
{
id:
/\d+/
}
do
member
do
delete
:delete_attachment
end
...
...
features/steps/dashboard/dashboard.rb
View file @
df9cbbc9
...
...
@@ -57,7 +57,7 @@ class Dashboard < Spinach::FeatureSteps
And
'I have group with projects'
do
@group
=
create
(
:group
)
@project
=
create
(
:project
,
group
:
@group
)
@project
=
create
(
:project
,
namespace
:
@group
)
@event
=
create
(
:closed_issue_event
,
project:
@project
)
@project
.
team
<<
[
current_user
,
:master
]
...
...
features/steps/group/group.rb
View file @
df9cbbc9
...
...
@@ -11,7 +11,7 @@ class Groups < Spinach::FeatureSteps
And
'I have group with projects'
do
@group
=
create
(
:group
,
owner:
current_user
)
@project
=
create
(
:project
,
group
:
@group
)
@project
=
create
(
:project
,
namespace
:
@group
)
@event
=
create
(
:closed_issue_event
,
project:
@project
)
@project
.
team
<<
[
current_user
,
:master
]
...
...
features/steps/project/project_network_graph.rb
View file @
df9cbbc9
...
...
@@ -38,11 +38,6 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
sleep
2
end
When
'I switch ref to "v2.1.0"'
do
page
.
select
'v2.1.0'
,
from:
'ref'
sleep
2
end
When
'click "Show only selected branch" checkbox'
do
find
(
'#filter_ref'
).
click
sleep
2
...
...
lib/api/merge_requests.rb
View file @
df9cbbc9
...
...
@@ -4,7 +4,7 @@ module API
before
{
authenticate!
}
before
{
Thread
.
current
[
:current_user
]
=
current_user
}
resource
:projects
do
resource
:projects
,
requirements:
{
id:
/[a-zA-Z.0-9_\-]+\/[a-zA-Z.0-9_\-]+/
}
do
helpers
do
def
handle_merge_request_errors!
(
errors
)
if
errors
[
:project_access
].
any?
...
...
spec/controllers/blob_controller_spec.rb
View file @
df9cbbc9
...
...
@@ -17,7 +17,7 @@ describe Projects::BlobController do
describe
"GET show"
do
render_views
before
{
get
:show
,
project_id:
project
.
code
,
id:
id
}
before
{
get
:show
,
project_id:
project
.
to_param
,
id:
id
}
context
"valid branch, valid file"
do
let
(
:id
)
{
'master/README.md'
}
...
...
spec/controllers/commit_controller_spec.rb
View file @
df9cbbc9
...
...
@@ -13,7 +13,7 @@ describe Projects::CommitController do
describe
"#show"
do
shared_examples
"export as"
do
|
format
|
it
"should generally work"
do
get
:show
,
project_id:
project
.
code
,
id:
commit
.
id
,
format:
format
get
:show
,
project_id:
project
.
to_param
,
id:
commit
.
id
,
format:
format
expect
(
response
).
to
be_success
end
...
...
@@ -21,11 +21,11 @@ describe Projects::CommitController do
it
"should generate it"
do
Commit
.
any_instance
.
should_receive
(
:"to_
#{
format
}
"
)
get
:show
,
project_id:
project
.
code
,
id:
commit
.
id
,
format:
format
get
:show
,
project_id:
project
.
to_param
,
id:
commit
.
id
,
format:
format
end
it
"should render it"
do
get
:show
,
project_id:
project
.
code
,
id:
commit
.
id
,
format:
format
get
:show
,
project_id:
project
.
to_param
,
id:
commit
.
id
,
format:
format
expect
(
response
.
body
).
to
eq
(
commit
.
send
(
:"to_
#{
format
}
"
))
end
...
...
@@ -33,7 +33,7 @@ describe Projects::CommitController do
it
"should not escape Html"
do
Commit
.
any_instance
.
stub
(
:"to_
#{
format
}
"
).
and_return
(
'HTML entities &<>" '
)
get
:show
,
project_id:
project
.
code
,
id:
commit
.
id
,
format:
format
get
:show
,
project_id:
project
.
to_param
,
id:
commit
.
id
,
format:
format
expect
(
response
.
body
).
to_not
include
(
'&'
)
expect
(
response
.
body
).
to_not
include
(
'>'
)
...
...
@@ -47,7 +47,7 @@ describe Projects::CommitController do
let
(
:format
)
{
:diff
}
it
"should really only be a git diff"
do
get
:show
,
project_id:
project
.
code
,
id:
commit
.
id
,
format:
format
get
:show
,
project_id:
project
.
to_param
,
id:
commit
.
id
,
format:
format
expect
(
response
.
body
).
to
start_with
(
"diff --git"
)
end
...
...
@@ -58,13 +58,13 @@ describe Projects::CommitController do
let
(
:format
)
{
:patch
}
it
"should really be a git email patch"
do
get
:show
,
project_id:
project
.
code
,
id:
commit
.
id
,
format:
format
get
:show
,
project_id:
project
.
to_param
,
id:
commit
.
id
,
format:
format
expect
(
response
.
body
).
to
start_with
(
"From
#{
commit
.
id
}
"
)
end
it
"should contain a git diff"
do
get
:show
,
project_id:
project
.
code
,
id:
commit
.
id
,
format:
format
get
:show
,
project_id:
project
.
to_param
,
id:
commit
.
id
,
format:
format
expect
(
response
.
body
).
to
match
(
/^diff --git/
)
end
...
...
spec/controllers/commits_controller_spec.rb
View file @
df9cbbc9
...
...
@@ -13,7 +13,7 @@ describe Projects::CommitsController do
describe
"GET show"
do
context
"as atom feed"
do
it
"should render as atom"
do
get
:show
,
project_id:
project
.
path
,
id:
"master"
,
format:
"atom"
get
:show
,
project_id:
project
.
to_param
,
id:
"master"
,
format:
"atom"
response
.
should
be_success
response
.
content_type
.
should
==
'application/atom+xml'
end
...
...
spec/controllers/merge_requests_controller_spec.rb
View file @
df9cbbc9
...
...
@@ -14,7 +14,7 @@ describe Projects::MergeRequestsController do
describe
"#show"
do
shared_examples
"export merge as"
do
|
format
|
it
"should generally work"
do
get
:show
,
project_id:
project
.
code
,
id:
merge_request
.
iid
,
format:
format
get
:show
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
expect
(
response
).
to
be_success
end
...
...
@@ -22,11 +22,11 @@ describe Projects::MergeRequestsController do
it
"should generate it"
do
MergeRequest
.
any_instance
.
should_receive
(
:"to_
#{
format
}
"
)
get
:show
,
project_id:
project
.
code
,
id:
merge_request
.
iid
,
format:
format
get
:show
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
end
it
"should render it"
do
get
:show
,
project_id:
project
.
code
,
id:
merge_request
.
iid
,
format:
format
get
:show
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
expect
(
response
.
body
).
to
eq
((
merge_request
.
send
(
:"to_
#{
format
}
"
,
user
)).
to_s
)
end
...
...
@@ -34,7 +34,7 @@ describe Projects::MergeRequestsController do
it
"should not escape Html"
do
MergeRequest
.
any_instance
.
stub
(
:"to_
#{
format
}
"
).
and_return
(
'HTML entities &<>" '
)
get
:show
,
project_id:
project
.
code
,
id:
merge_request
.
iid
,
format:
format
get
:show
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
expect
(
response
.
body
).
to_not
include
(
'&'
)
expect
(
response
.
body
).
to_not
include
(
'>'
)
...
...
@@ -48,7 +48,7 @@ describe Projects::MergeRequestsController do
let
(
:format
)
{
:diff
}
it
"should really only be a git diff"
do
get
:show
,
project_id:
project
.
code
,
id:
merge_request
.
iid
,
format:
format
get
:show
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
expect
(
response
.
body
).
to
start_with
(
"diff --git"
)
end
...
...
@@ -59,13 +59,13 @@ describe Projects::MergeRequestsController do
let
(
:format
)
{
:patch
}
it
"should really be a git email patch with commit"
do
get
:show
,
project_id:
project
.
code
,
id:
merge_request
.
iid
,
format:
format
get
:show
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
expect
(
response
.
body
[
0
..
100
]).
to
start_with
(
"From
#{
merge_request
.
commits
.
last
.
id
}
"
)
end
it
"should contain git diffs"
do
get
:show
,
project_id:
project
.
code
,
id:
merge_request
.
iid
,
format:
format
get
:show
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
expect
(
response
.
body
).
to
match
(
/^diff --git/
)
end
...
...
spec/controllers/tree_controller_spec.rb
View file @
df9cbbc9
...
...
@@ -18,7 +18,7 @@ describe Projects::TreeController do
# Make sure any errors accessing the tree in our views bubble up to this spec
render_views
before
{
get
:show
,
project_id:
project
.
code
,
id:
id
}
before
{
get
:show
,
project_id:
project
.
to_param
,
id:
id
}
context
"valid branch, no path"
do
let
(
:id
)
{
'master'
}
...
...
spec/factories.rb
View file @
df9cbbc9
...
...
@@ -28,6 +28,7 @@ FactoryGirl.define do
factory
:project
do
sequence
(
:name
)
{
|
n
|
"project
#{
n
}
"
}
path
{
name
.
downcase
.
gsub
(
/\s/
,
'_'
)
}
namespace
creator
trait
:source
do
...
...
spec/features/atom/issues_spec.rb
View file @
df9cbbc9
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
"Issues Feed"
do
describe
"GET /issues"
do
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:issue
)
{
create
(
:issue
,
author:
user
,
project:
project
)
}
before
{
project
.
team
<<
[
user
,
:developer
]
}
...
...
spec/models/project_spec.rb
View file @
df9cbbc9
...
...
@@ -58,11 +58,11 @@ describe Project do
let!
(
:project
)
{
create
(
:project
)
}
it
{
should
validate_presence_of
(
:name
)
}
it
{
should
validate_uniqueness_of
(
:name
)
}
it
{
should
validate_uniqueness_of
(
:name
)
.
scoped_to
(
:namespace_id
)
}
it
{
should
ensure_length_of
(
:name
).
is_within
(
0
..
255
)
}
it
{
should
validate_presence_of
(
:path
)
}
it
{
should
validate_uniqueness_of
(
:path
)
}
it
{
should
validate_uniqueness_of
(
:path
)
.
scoped_to
(
:namespace_id
)
}
it
{
should
ensure_length_of
(
:path
).
is_within
(
0
..
255
)
}
it
{
should
ensure_length_of
(
:description
).
is_within
(
0
..
2000
)
}
it
{
should
validate_presence_of
(
:creator
)
}
...
...
@@ -157,15 +157,6 @@ describe Project do
it
{
Project
.
find_with_namespace
(
'gitlab/gitlab-ci'
).
should
==
@project
}
it
{
Project
.
find_with_namespace
(
'gitlab-ci'
).
should
be_nil
}
end
context
'w/o namespace'
do
before
do
@project
=
create
(
:project
,
name:
'gitlab-ci'
)
end
it
{
Project
.
find_with_namespace
(
'gitlab-ci'
).
should
==
@project
}
it
{
Project
.
find_with_namespace
(
'gitlab/gitlab-ci'
).
should
be_nil
}
end
end
describe
:to_param
do
...
...
@@ -177,14 +168,6 @@ describe Project do
it
{
@project
.
to_param
.
should
==
"gitlab/gitlab-ci"
}
end
context
'w/o namespace'
do
before
do
@project
=
create
(
:project
,
name:
'gitlab-ci'
)
end
it
{
@project
.
to_param
.
should
==
"gitlab-ci"
}
end
end
describe
:repository
do
...
...
spec/requests/api/merge_requests_spec.rb
View file @
df9cbbc9
This diff is collapsed.
Click to expand it.
spec/routing/project_routing_spec.rb
View file @
df9cbbc9
This diff is collapsed.
Click to expand it.
spec/routing/routing_spec.rb
View file @
df9cbbc9
...
...
@@ -11,11 +11,11 @@ end
# /:path Grack
describe
"Mounted Apps"
,
"routing"
do
it
"to API"
do
get
(
"/api"
).
should
be_routable
get
(
"/api
/issues
"
).
should
be_routable
end
it
"to Grack"
do
get
(
"/gitlabhq.git"
).
should
be_routable
get
(
"/gitlab
/gitlab
hq.git"
).
should
be_routable
end
end
...
...
spec/services/git_push_service_spec.rb
View file @
df9cbbc9
...
...
@@ -48,7 +48,7 @@ describe GitPushService do
it
{
should
include
(
id:
@commit
.
id
)
}
it
{
should
include
(
message:
@commit
.
safe_message
)
}
it
{
should
include
(
timestamp:
@commit
.
date
.
xmlschema
)
}
it
{
should
include
(
url:
"
#{
Gitlab
.
config
.
gitlab
.
url
}
/
#{
project
.
code
}
/commit/
#{
@commit
.
id
}
"
)
}
it
{
should
include
(
url:
"
#{
Gitlab
.
config
.
gitlab
.
url
}
/
#{
project
.
to_param
}
/commit/
#{
@commit
.
id
}
"
)
}
context
"with a author"
do
subject
{
@push_data
[
:commits
].
first
[
:author
]
}
...
...
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