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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
a3ef6831
Commit
a3ef6831
authored
Sep 17, 2013
by
Hiroyuki Sato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop support of root namespace in model
parent
2d31a9f3
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
19 additions
and
26 deletions
+19
-26
app/models/project.rb
app/models/project.rb
+2
-5
spec/contexts/issues/bulk_update_context_spec.rb
spec/contexts/issues/bulk_update_context_spec.rb
+4
-1
spec/contexts/projects_create_context_spec.rb
spec/contexts/projects_create_context_spec.rb
+5
-1
spec/models/project_spec.rb
spec/models/project_spec.rb
+1
-0
spec/requests/api/internal_spec.rb
spec/requests/api/internal_spec.rb
+2
-0
spec/requests/api/issues_spec.rb
spec/requests/api/issues_spec.rb
+2
-0
spec/requests/api/notes_spec.rb
spec/requests/api/notes_spec.rb
+2
-0
spec/services/project_transfer_service_spec.rb
spec/services/project_transfer_service_spec.rb
+1
-19
No files found.
app/models/project.rb
View file @
a3ef6831
...
...
@@ -83,6 +83,7 @@ class Project < ActiveRecord::Base
:wiki_enabled
,
inclusion:
{
in:
[
true
,
false
]
}
validates
:issues_tracker_id
,
length:
{
within:
0
..
255
}
validates
:namespace
,
presence:
true
validates_uniqueness_of
:name
,
scope: :namespace_id
validates_uniqueness_of
:path
,
scope: :namespace_id
...
...
@@ -165,11 +166,7 @@ class Project < ActiveRecord::Base
end
def
to_param
if
namespace
namespace
.
path
+
"/"
+
path
else
path
end
end
def
web_url
...
...
spec/contexts/issues/bulk_update_context_spec.rb
View file @
a3ef6831
require
'spec_helper'
describe
Issues
::
BulkUpdateContext
do
before
(
:each
)
{
ActiveRecord
::
Base
.
observers
.
enable
(
:user_observer
)
}
after
(
:each
)
{
ActiveRecord
::
Base
.
observers
.
disable
(
:user_observer
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
@project
)
...
...
@@ -9,7 +11,8 @@ describe Issues::BulkUpdateContext do
before
do
@user
=
create
:user
opts
=
{
name:
"GitLab"
name:
"GitLab"
,
namespace:
@user
.
namespace
}
@project
=
Projects
::
CreateContext
.
new
(
@user
,
opts
).
execute
end
...
...
spec/contexts/projects_create_context_spec.rb
View file @
a3ef6831
require
'spec_helper'
describe
Projects
::
CreateContext
do
before
(
:each
)
{
ActiveRecord
::
Base
.
observers
.
enable
(
:user_observer
)
}
after
(
:each
)
{
ActiveRecord
::
Base
.
observers
.
disable
(
:user_observer
)
}
describe
:create_by_user
do
before
do
@user
=
create
:user
@opts
=
{
name:
"GitLab"
name:
"GitLab"
,
namespace:
@user
.
namespace
}
end
...
...
spec/models/project_spec.rb
View file @
a3ef6831
...
...
@@ -67,6 +67,7 @@ describe Project do
it
{
should
ensure_length_of
(
:description
).
is_within
(
0
..
2000
)
}
it
{
should
validate_presence_of
(
:creator
)
}
it
{
should
ensure_length_of
(
:issues_tracker_id
).
is_within
(
0
..
255
)
}
it
{
should
validate_presence_of
(
:namespace
)
}
it
"should not allow new projects beyond user limits"
do
project2
=
build
(
:project
)
...
...
spec/requests/api/internal_spec.rb
View file @
a3ef6831
...
...
@@ -2,6 +2,8 @@ require 'spec_helper'
describe
API
::
API
do
include
ApiHelpers
before
(
:each
)
{
ActiveRecord
::
Base
.
observers
.
enable
(
:user_observer
)
}
after
(
:each
)
{
ActiveRecord
::
Base
.
observers
.
disable
(
:user_observer
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:key
)
{
create
(
:key
,
user:
user
)
}
...
...
spec/requests/api/issues_spec.rb
View file @
a3ef6831
...
...
@@ -2,6 +2,8 @@ require 'spec_helper'
describe
API
::
API
do
include
ApiHelpers
before
(
:each
)
{
ActiveRecord
::
Base
.
observers
.
enable
(
:user_observer
)
}
after
(
:each
)
{
ActiveRecord
::
Base
.
observers
.
disable
(
:user_observer
)
}
let
(
:user
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
...
...
spec/requests/api/notes_spec.rb
View file @
a3ef6831
...
...
@@ -2,6 +2,8 @@ require 'spec_helper'
describe
API
::
API
do
include
ApiHelpers
before
(
:each
)
{
ActiveRecord
::
Base
.
observers
.
enable
(
:user_observer
)
}
after
(
:each
)
{
ActiveRecord
::
Base
.
observers
.
disable
(
:user_observer
)
}
let
(
:user
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
...
...
spec/services/project_transfer_service_spec.rb
View file @
a3ef6831
...
...
@@ -21,25 +21,7 @@ describe ProjectTransferService do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
before
do
@result
=
service
.
transfer
(
project
,
nil
)
end
it
{
@result
.
should
be_true
}
it
{
project
.
namespace
.
should
==
nil
}
end
context
'no namespace -> namespace'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
@result
=
service
.
transfer
(
project
,
user
.
namespace
)
end
it
{
@result
.
should
be_true
}
it
{
project
.
namespace
.
should
==
user
.
namespace
}
it
{
lambda
{
service
.
transfer
(
project
,
nil
)}.
should
raise_error
(
ActiveRecord
::
RecordInvalid
)
}
end
def
service
...
...
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