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
901c3d5e
Commit
901c3d5e
authored
Jul 31, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid expect_any_instance_of because it doesn't work
well with prepend. We need to backport this
parent
d8aec0b7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
spec/services/projects/transfer_service_spec.rb
spec/services/projects/transfer_service_spec.rb
+13
-9
No files found.
spec/services/projects/transfer_service_spec.rb
View file @
901c3d5e
...
@@ -37,18 +37,18 @@ describe Projects::TransferService do
...
@@ -37,18 +37,18 @@ describe Projects::TransferService do
end
end
it
'executes system hooks'
do
it
'executes system hooks'
do
expect_any_instance_of
(
SystemHooksService
).
to
receive
(
:execute_hooks_for
).
with
(
project
,
:transfer
)
transfer_project
(
project
,
user
,
group
)
do
|
service
|
expect
(
service
).
to
receive
(
:execute_system_hooks
)
transfer_project
(
project
,
user
,
group
)
end
end
end
end
end
context
'when transfer fails'
do
context
'when transfer fails'
do
let!
(
:original_path
)
{
project_path
(
project
)
}
let!
(
:original_path
)
{
project_path
(
project
)
}
def
attempt_project_transfer
def
attempt_project_transfer
(
&
block
)
expect
do
expect
do
transfer_project
(
project
,
user
,
group
)
transfer_project
(
project
,
user
,
group
,
&
block
)
end
.
to
raise_error
(
ActiveRecord
::
ActiveRecordError
)
end
.
to
raise_error
(
ActiveRecord
::
ActiveRecordError
)
end
end
...
@@ -80,9 +80,9 @@ describe Projects::TransferService do
...
@@ -80,9 +80,9 @@ describe Projects::TransferService do
end
end
it
"doesn't run system hooks"
do
it
"doesn't run system hooks"
do
expect_any_instance_of
(
SystemHooksService
).
not_to
receive
(
:execute_hooks_for
).
with
(
project
,
:transfer
)
attempt_project_transfer
do
|
service
|
expect
(
service
).
not_to
receive
(
:execute_system_hooks
)
attempt_project_transfer
end
end
end
end
end
...
@@ -120,7 +120,11 @@ describe Projects::TransferService do
...
@@ -120,7 +120,11 @@ describe Projects::TransferService do
end
end
def
transfer_project
(
project
,
user
,
new_namespace
)
def
transfer_project
(
project
,
user
,
new_namespace
)
Projects
::
TransferService
.
new
(
project
,
user
).
execute
(
new_namespace
)
service
=
Projects
::
TransferService
.
new
(
project
,
user
)
yield
(
service
)
if
block_given?
service
.
execute
(
new_namespace
)
end
end
context
'visibility level'
do
context
'visibility level'
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