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
Léo-Paul Géneau
gitlab-ce
Commits
65427442
Commit
65427442
authored
Feb 16, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored a couple of things
parent
cec1e3eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
12 deletions
+9
-12
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
+9
-12
No files found.
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
View file @
65427442
...
...
@@ -4,18 +4,19 @@ include ImportExport::CommonUtil
describe
Gitlab
::
ImportExport
::
ProjectTreeRestorer
,
services:
true
do
describe
'restore project tree'
do
before
(
:all
)
do
user
=
create
(
:user
)
@
user
=
create
(
:user
)
RSpec
::
Mocks
.
with_temporary_scope
do
@shared
=
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path:
""
,
project_path:
'path'
)
allow
(
@shared
).
to
receive
(
:export_path
).
and_return
(
'spec/lib/gitlab/import_export/'
)
project
=
create
(
:empty_project
,
:builds_disabled
,
:issues_disabled
,
name:
'project'
,
path:
'project'
)
project_tree_restorer
=
described_class
.
new
(
user:
user
,
shared:
@shared
,
project:
project
)
@
project
=
create
(
:empty_project
,
:builds_disabled
,
:issues_disabled
,
name:
'project'
,
path:
'project'
)
project_tree_restorer
=
described_class
.
new
(
user:
@user
,
shared:
@shared
,
project:
@
project
)
@restored_project_json
=
project_tree_restorer
.
restore
end
end
before
do
after
(
:all
)
do
@user
.
destroy!
end
context
'JSON'
do
...
...
@@ -98,7 +99,7 @@ describe Gitlab::ImportExport::ProjectTreeRestorer, services: true do
end
it
'has a project feature'
do
expect
(
Project
.
firs
t
.
project_feature
).
not_to
be_nil
expect
(
@projec
t
.
project_feature
).
not_to
be_nil
end
it
'restores the correct service'
do
...
...
@@ -106,20 +107,16 @@ describe Gitlab::ImportExport::ProjectTreeRestorer, services: true do
end
context
'Merge requests'
do
before
do
@restored_project_json
end
it
'always has the new project as a target'
do
expect
(
MergeRequest
.
find_by_title
(
'MR1'
).
target_project
).
to
eq
(
Project
.
firs
t
)
expect
(
MergeRequest
.
find_by_title
(
'MR1'
).
target_project
).
to
eq
(
@projec
t
)
end
it
'has the same source project as originally if source/target are the same'
do
expect
(
MergeRequest
.
find_by_title
(
'MR1'
).
source_project
).
to
eq
(
Project
.
firs
t
)
expect
(
MergeRequest
.
find_by_title
(
'MR1'
).
source_project
).
to
eq
(
@projec
t
)
end
it
'has the new project as target if source/target differ'
do
expect
(
MergeRequest
.
find_by_title
(
'MR2'
).
target_project
).
to
eq
(
Project
.
firs
t
)
expect
(
MergeRequest
.
find_by_title
(
'MR2'
).
target_project
).
to
eq
(
@projec
t
)
end
it
'has no source if source/target differ'
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