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
f683c580
Commit
f683c580
authored
Apr 01, 2020
by
Melvin Vermeeren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add helper method in project Import/Export tree restorer
parent
88c593f8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
spec/lib/gitlab/import_export/project/tree_restorer_spec.rb
spec/lib/gitlab/import_export/project/tree_restorer_spec.rb
+8
-7
No files found.
spec/lib/gitlab/import_export/project/tree_restorer_spec.rb
View file @
f683c580
...
...
@@ -2,6 +2,10 @@
require
'spec_helper'
def
match_mr1_note
(
content_regex
)
MergeRequest
.
find_by
(
title:
'MR1'
).
notes
.
select
{
|
n
|
n
.
note
.
match
(
/
#{
content_regex
}
/
)}.
first
end
describe
Gitlab
::
ImportExport
::
Project
::
TreeRestorer
do
include
ImportExport
::
CommonUtil
...
...
@@ -74,15 +78,14 @@ describe Gitlab::ImportExport::Project::TreeRestorer do
context
'for a Merge Request'
do
it
'does not import note_html'
do
note_content
=
'Sit voluptatibus eveniet architecto quidem'
merge_request_note
=
MergeRequest
.
find_by
(
title:
'MR1'
).
notes
.
select
{
|
n
|
n
.
note
.
match
(
/
#{
note_content
}
/
)}.
first
merge_request_note
=
match_mr1_note
(
note_content
)
expect
(
merge_request_note
.
note_html
).
to
match
(
/
#{
note_content
}
/
)
end
context
'merge request system note metadata'
do
it
'restores title action for unmark wip'
do
note_content
=
'unmarked as a \\*\\*Work In Progress\\*\\*'
merge_request_note
=
MergeRequest
.
find_by
(
title:
'MR1'
).
notes
.
select
{
|
n
|
n
.
note
.
match
(
/
#{
note_content
}
/
)}.
first
merge_request_note
=
match_mr1_note
(
'unmarked as a \\*\\*Work In Progress\\*\\*'
)
expect
(
merge_request_note
.
noteable_type
).
to
eq
(
'MergeRequest'
)
expect
(
merge_request_note
.
system
).
to
eq
(
true
)
...
...
@@ -91,8 +94,7 @@ describe Gitlab::ImportExport::Project::TreeRestorer do
end
it
'restores commit action and commit count for pushing 3 commits'
do
note_content
=
'added 3 commits'
merge_request_note
=
MergeRequest
.
find_by
(
title:
'MR1'
).
notes
.
select
{
|
n
|
n
.
note
.
match
(
/
#{
note_content
}
/
)}.
first
merge_request_note
=
match_mr1_note
(
'added 3 commits'
)
expect
(
merge_request_note
.
noteable_type
).
to
eq
(
'MergeRequest'
)
expect
(
merge_request_note
.
system
).
to
eq
(
true
)
...
...
@@ -395,8 +397,7 @@ describe Gitlab::ImportExport::Project::TreeRestorer do
context
'notes'
do
it
'has award emoji'
do
note_content
=
'Sit voluptatibus eveniet architecto quidem'
merge_request_note
=
MergeRequest
.
find_by
(
title:
'MR1'
).
notes
.
select
{
|
n
|
n
.
note
.
match
(
/
#{
note_content
}
/
)}.
first
merge_request_note
=
match_mr1_note
(
'Sit voluptatibus eveniet architecto quidem'
)
award_emoji
=
merge_request_note
.
award_emoji
.
first
expect
(
award_emoji
.
name
).
to
eq
(
'tada'
)
...
...
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