Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
ec8fa5781b5d
Commit
db41342d
authored
Nov 24, 2017
by
Gabriel Mazetto
Browse files
Backport EE changes to make test possible when prepending modules
parent
50d06033b60f
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/services/projects/hashed_storage/migrate_attachments_service.rb
View file @
ec8fa578
...
...
@@ -17,6 +17,10 @@ def execute
move_folder!
(
old_path
,
new_path
)
project
.
save!
if
block_given?
yield
end
end
private
...
...
app/services/projects/hashed_storage/migrate_repository_service.rb
View file @
ec8fa578
...
...
@@ -35,6 +35,10 @@ def execute
project
.
repository_read_only
=
false
project
.
save!
if
result
&&
block_given?
yield
end
result
end
...
...
spec/services/projects/hashed_storage_migration_service_spec.rb
View file @
ec8fa578
...
...
@@ -6,32 +6,36 @@
describe
'#execute'
do
context
'repository migration'
do
let
(
:repository_service
)
{
Projects
::
HashedStorage
::
MigrateRepositoryService
.
new
(
project
,
subject
.
logger
)
}
it
'delegates migration to Projects::HashedStorage::MigrateRepositoryService'
do
expect
(
Projects
::
HashedStorage
::
MigrateRepositoryService
).
to
receive
(
:new
).
with
(
project
,
subject
.
logger
).
and_
call_original
expect
_any_instance_of
(
Projects
::
HashedStorage
::
MigrateR
epository
S
ervice
).
to
receive
(
:execute
)
expect
(
Projects
::
HashedStorage
::
MigrateRepositoryService
).
to
receive
(
:new
).
with
(
project
,
subject
.
logger
).
and_
return
(
repository_service
)
expect
(
r
epository
_s
ervice
).
to
receive
(
:execute
)
service
.
execute
end
it
'does not delegate migration if repository is already migrated'
do
project
.
storage_version
=
::
Project
::
LATEST_STORAGE_VERSION
expect
_any_instance_of
(
Projects
::
HashedStorage
::
MigrateRepositoryService
).
not_to
receive
(
:
execute
)
expect
(
Projects
::
HashedStorage
::
MigrateRepositoryService
).
not_to
receive
(
:
new
)
service
.
execute
end
end
context
'attachments migration'
do
let
(
:attachments_service
)
{
Projects
::
HashedStorage
::
MigrateAttachmentsService
.
new
(
project
,
subject
.
logger
)
}
it
'delegates migration to Projects::HashedStorage::MigrateRepositoryService'
do
expect
(
Projects
::
HashedStorage
::
MigrateAttachmentsService
).
to
receive
(
:new
).
with
(
project
,
subject
.
logger
).
and_
call_original
expect
_any_instance_of
(
Projects
::
HashedStorage
::
MigrateA
ttachments
S
ervice
).
to
receive
(
:execute
)
expect
(
Projects
::
HashedStorage
::
MigrateAttachmentsService
).
to
receive
(
:new
).
with
(
project
,
subject
.
logger
).
and_
return
(
attachments_service
)
expect
(
a
ttachments
_s
ervice
).
to
receive
(
:execute
)
service
.
execute
end
it
'does not delegate migration if attachments are already migrated'
do
project
.
storage_version
=
::
Project
::
LATEST_STORAGE_VERSION
expect
_any_instance_of
(
Projects
::
HashedStorage
::
MigrateAttachmentsService
).
not_to
receive
(
:
execute
)
expect
(
Projects
::
HashedStorage
::
MigrateAttachmentsService
).
not_to
receive
(
:
new
)
service
.
execute
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