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
acd573f1
Commit
acd573f1
authored
May 18, 2017
by
Jose Ivan Vargas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor adjustments to the specs
parent
fbde5e33
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
12 deletions
+11
-12
app/services/projects/transfer_service.rb
app/services/projects/transfer_service.rb
+1
-1
spec/controllers/projects_controller_spec.rb
spec/controllers/projects_controller_spec.rb
+9
-10
spec/services/projects/transfer_service_spec.rb
spec/services/projects/transfer_service_spec.rb
+1
-1
No files found.
app/services/projects/transfer_service.rb
View file @
acd573f1
...
...
@@ -12,7 +12,7 @@ module Projects
TransferError
=
Class
.
new
(
StandardError
)
def
execute
(
new_namespace
)
if
allowed_transfer?
(
current_user
,
project
,
new_namespace
)
if
!
new_namespace
.
blank?
&&
allowed_transfer?
(
current_user
,
project
,
new_namespace
)
transfer
(
project
,
new_namespace
)
else
error_message
=
if
new_namespace
.
blank?
...
...
spec/controllers/projects_controller_spec.rb
View file @
acd573f1
...
...
@@ -229,23 +229,22 @@ describe ProjectsController do
describe
'#transfer'
do
render_views
subjec
t
(
:project
)
{
create
(
:project
)
}
le
t
(
:project
)
{
create
(
:project
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:new_namespace
)
{
create
(
:namespace
)
}
it
'updates namespace'
do
controller
.
instance_variable_set
(
:@project
,
project
)
sign_in
(
admin
)
put
:transfer
,
namespace_id:
project
.
namespace
.
id
,
namespace_id:
project
.
namespace
.
path
,
new_namespace_id:
new_namespace
.
id
,
id:
project
.
id
,
id:
project
.
path
,
format: :js
project
.
reload
expect
(
project
.
namespace
.
id
).
to
eq
(
new_namespace
.
id
)
expect
(
project
.
namespace
).
to
eq
(
new_namespace
)
expect
(
response
).
to
have_http_status
(
200
)
end
...
...
@@ -254,17 +253,17 @@ describe ProjectsController do
controller
.
instance_variable_set
(
:@project
,
project
)
sign_in
(
admin
)
old_namespace
_id
=
project
.
namespace
.
id
old_namespace
=
project
.
namespace
put
:transfer
,
namespace_id:
old_namespace
_id
,
namespace_id:
old_namespace
.
path
,
new_namespace_id:
nil
,
id:
project
.
id
,
id:
project
.
path
,
format: :js
project
.
reload
expect
(
project
.
namespace
.
id
).
to
eq
(
old_namespace_id
)
expect
(
project
.
namespace
).
to
eq
(
old_namespace
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
flash
[
:alert
]).
to
eq
'Please select a new namespace for your project.'
end
...
...
spec/services/projects/transfer_service_spec.rb
View file @
acd573f1
...
...
@@ -26,7 +26,7 @@ describe Projects::TransferService, services: true do
it
{
expect
(
@result
).
to
eq
false
}
it
{
expect
(
project
.
namespace
).
to
eq
(
user
.
namespace
)
}
it
{
expect
(
project
.
errors
.
messages
[
:new_namespace
]
[
0
]
).
to
eq
'Please select a new namespace for your project.'
}
it
{
expect
(
project
.
errors
.
messages
[
:new_namespace
]
.
first
).
to
eq
'Please select a new namespace for your project.'
}
end
context
'disallow transfering of project with tags'
do
...
...
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