BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
12 deletions
+11
-12
transfer_service.rb
app/services/projects/transfer_service.rb
+1
-1
projects_controller_spec.rb
spec/controllers/projects_controller_spec.rb
+9
-10
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,18 +253,18 @@ 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
(
response
).
to
have_http_status
(
200
)
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
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