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
14f78d06
Commit
14f78d06
authored
May 28, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify specs for new project transfer code
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
900d3079
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
16 deletions
+29
-16
spec/requests/api/groups_spec.rb
spec/requests/api/groups_spec.rb
+2
-2
spec/services/projects/transfer_service_spec.rb
spec/services/projects/transfer_service_spec.rb
+27
-14
No files found.
spec/requests/api/groups_spec.rb
View file @
14f78d06
...
...
@@ -147,7 +147,7 @@ describe API::API, api: true do
describe
"POST /groups/:id/projects/:project_id"
do
let
(
:project
)
{
create
(
:project
)
}
before
(
:each
)
do
project
.
stub
(
:transfer
).
and_return
(
true
)
Projects
::
TransferService
.
any_instance
.
stub
(
execute:
true
)
Project
.
stub
(
:find
).
and_return
(
project
)
end
...
...
@@ -160,8 +160,8 @@ describe API::API, api: true do
context
"when authenticated as admin"
do
it
"should transfer project to group"
do
project
.
should_receive
(
:transfer
)
post
api
(
"/groups/
#{
group1
.
id
}
/projects/
#{
project
.
id
}
"
,
admin
)
response
.
status
.
should
==
201
end
end
end
...
...
spec/services/projects/transfer_service_spec.rb
View file @
14f78d06
require
'spec_helper'
describe
ProjectTransferService
do
describe
Project
s
::
TransferService
do
before
(
:each
)
{
enable_observers
}
after
(
:each
)
{
disable_observers
}
context
'namespace -> namespace'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:group2
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
context
'namespace -> namespace'
do
before
do
@result
=
service
.
transfer
(
project
,
group
)
group
.
add_owner
(
user
)
@service
=
Projects
::
TransferService
.
new
(
project
,
user
,
namespace_id:
group
.
id
)
@service
.
gitlab_shell
.
stub
(
mv_repository:
true
)
@result
=
@service
.
execute
end
it
{
@result
.
should
be_true
}
...
...
@@ -18,16 +22,25 @@ describe ProjectTransferService do
end
context
'namespace -> no namespace'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
before
do
group
.
add_owner
(
user
)
@service
=
Projects
::
TransferService
.
new
(
project
,
user
,
namespace_id:
nil
)
@service
.
gitlab_shell
.
stub
(
mv_repository:
true
)
@result
=
@service
.
execute
end
it
{
lambda
{
service
.
transfer
(
project
,
nil
)}.
should
raise_error
(
ActiveRecord
::
RecordInvalid
)
}
it
{
@result
.
should
be_false
}
it
{
project
.
namespace
.
should
==
user
.
namespace
}
end
def
service
service
=
ProjectTransferService
.
new
service
.
gitlab_shell
.
stub
(
mv_repository:
true
)
service
context
'namespace -> not allowed namespace'
do
before
do
@service
=
Projects
::
TransferService
.
new
(
project
,
user
,
namespace_id:
group2
.
id
)
@service
.
gitlab_shell
.
stub
(
mv_repository:
true
)
@result
=
@service
.
execute
end
it
{
@result
.
should
be_false
}
it
{
project
.
namespace
.
should
==
user
.
namespace
}
end
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