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
b5b99864
Commit
b5b99864
authored
Dec 23, 2019
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add expectation in Gitlab::ImportExport::GroupTreeSaver specs
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
56a7cabe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
ee/spec/lib/ee/gitlab/import_export/group_tree_saver_spec.rb
ee/spec/lib/ee/gitlab/import_export/group_tree_saver_spec.rb
+15
-2
lib/gitlab/import_export/group_tree_saver.rb
lib/gitlab/import_export/group_tree_saver.rb
+1
-1
No files found.
ee/spec/lib/ee/gitlab/import_export/group_tree_saver_spec.rb
View file @
b5b99864
...
...
@@ -17,7 +17,6 @@ describe Gitlab::ImportExport::GroupTreeSaver do
let
(
:group_tree_saver
)
{
described_class
.
new
(
group:
group
,
current_user:
user
,
shared:
shared
)
}
let
(
:saved_group_json
)
do
group_tree_saver
.
save
group_json
(
group_tree_saver
.
full_path
)
end
...
...
@@ -30,15 +29,18 @@ describe Gitlab::ImportExport::GroupTreeSaver do
end
it
'saves successfully'
do
expect
(
group_tree_saver
.
save
).
to
be
true
expect
_successful_save
(
group_tree_saver
)
end
context
'epics relation'
do
it
'saves top level epics'
do
expect_successful_save
(
group_tree_saver
)
expect
(
saved_group_json
[
'epics'
].
size
).
to
eq
(
2
)
end
it
'saves parent of epic'
do
expect_successful_save
(
group_tree_saver
)
parent
=
saved_group_json
[
'epics'
].
first
[
'parent'
]
expect
(
parent
).
not_to
be_empty
...
...
@@ -46,6 +48,8 @@ describe Gitlab::ImportExport::GroupTreeSaver do
end
it
'saves epic notes'
do
expect_successful_save
(
group_tree_saver
)
notes
=
saved_group_json
[
'epics'
].
first
[
'notes'
]
expect
(
notes
).
not_to
be_empty
...
...
@@ -56,14 +60,18 @@ describe Gitlab::ImportExport::GroupTreeSaver do
context
'boards relation'
do
it
'saves top level boards'
do
expect_successful_save
(
group_tree_saver
)
expect
(
saved_group_json
[
'boards'
].
size
).
to
eq
(
1
)
end
it
'saves board assignee'
do
expect_successful_save
(
group_tree_saver
)
expect
(
saved_group_json
[
'boards'
].
first
[
'board_assignee'
][
'assignee_id'
]).
to
eq
(
user
.
id
)
end
it
'saves board labels'
do
expect_successful_save
(
group_tree_saver
)
labels
=
saved_group_json
[
'boards'
].
first
[
'labels'
]
expect
(
labels
).
not_to
be_empty
...
...
@@ -72,6 +80,11 @@ describe Gitlab::ImportExport::GroupTreeSaver do
end
end
def
expect_successful_save
(
group_tree_saver
)
expect
(
group_tree_saver
.
save
).
to
be
true
expect
(
group_tree_saver
.
shared
.
errors
).
to
be_empty
end
def
group_json
(
filename
)
JSON
.
parse
(
IO
.
read
(
filename
))
end
...
...
lib/gitlab/import_export/group_tree_saver.rb
View file @
b5b99864
...
...
@@ -3,7 +3,7 @@
module
Gitlab
module
ImportExport
class
GroupTreeSaver
attr_reader
:full_path
attr_reader
:full_path
,
:shared
def
initialize
(
group
:,
current_user
:,
shared
:,
params:
{})
@params
=
params
...
...
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