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
3df6c529
Commit
3df6c529
authored
Apr 08, 2021
by
George Koltsov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix user reference transformation in EpicsPipeline
parent
1d5f280e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
13 deletions
+24
-13
changelogs/unreleased/georgekoltsov-fix-epics-pipeline.yml
changelogs/unreleased/georgekoltsov-fix-epics-pipeline.yml
+5
-0
ee/lib/ee/bulk_imports/groups/pipelines/epics_pipeline.rb
ee/lib/ee/bulk_imports/groups/pipelines/epics_pipeline.rb
+1
-2
ee/spec/lib/ee/bulk_imports/groups/pipelines/epics_pipeline_spec.rb
...b/ee/bulk_imports/groups/pipelines/epics_pipeline_spec.rb
+1
-1
lib/bulk_imports/common/transformers/user_reference_transformer.rb
...imports/common/transformers/user_reference_transformer.rb
+1
-1
spec/lib/bulk_imports/common/transformers/user_reference_transformer_spec.rb
...ts/common/transformers/user_reference_transformer_spec.rb
+16
-9
No files found.
changelogs/unreleased/georgekoltsov-fix-epics-pipeline.yml
0 → 100644
View file @
3df6c529
---
title
:
Fix user reference transformation in EpicsPipeline
merge_request
:
58913
author
:
type
:
fixed
ee/lib/ee/bulk_imports/groups/pipelines/epics_pipeline.rb
View file @
3df6c529
...
...
@@ -11,8 +11,7 @@ module EE
query:
EE
::
BulkImports
::
Groups
::
Graphql
::
GetEpicsQuery
transformer
::
BulkImports
::
Common
::
Transformers
::
ProhibitedAttributesTransformer
transformer
::
BulkImports
::
Common
::
Transformers
::
UserReferenceTransformer
,
reference: :author
transformer
::
BulkImports
::
Common
::
Transformers
::
UserReferenceTransformer
,
reference:
'author'
transformer
EE
::
BulkImports
::
Groups
::
Transformers
::
EpicAttributesTransformer
def
transform
(
_
,
data
)
...
...
ee/spec/lib/ee/bulk_imports/groups/pipelines/epics_pipeline_spec.rb
View file @
3df6c529
...
...
@@ -125,7 +125,7 @@ RSpec.describe EE::BulkImports::Groups::Pipelines::EpicsPipeline, :clean_gitlab_
expect
(
described_class
.
transformers
)
.
to
contain_exactly
(
{
klass:
BulkImports
::
Common
::
Transformers
::
ProhibitedAttributesTransformer
,
options:
nil
},
{
klass:
BulkImports
::
Common
::
Transformers
::
UserReferenceTransformer
,
options:
{
reference:
:author
}
},
{
klass:
BulkImports
::
Common
::
Transformers
::
UserReferenceTransformer
,
options:
{
reference:
'author'
}
},
{
klass:
EE
::
BulkImports
::
Groups
::
Transformers
::
EpicAttributesTransformer
,
options:
nil
}
)
end
...
...
lib/bulk_imports/common/transformers/user_reference_transformer.rb
View file @
3df6c529
...
...
@@ -12,7 +12,7 @@ module BulkImports
DEFAULT_REFERENCE
=
'user'
def
initialize
(
options
=
{})
@reference
=
options
[
:reference
]
||
DEFAULT_REFERENCE
@reference
=
options
[
:reference
]
.
to_s
.
presence
||
DEFAULT_REFERENCE
@suffixed_reference
=
"
#{
@reference
}
_id"
end
...
...
spec/lib/bulk_imports/common/transformers/user_reference_transformer_spec.rb
View file @
3df6c529
...
...
@@ -52,19 +52,26 @@ RSpec.describe BulkImports::Common::Transformers::UserReferenceTransformer do
end
context
'when custom reference is provided'
do
it
'updates provided reference'
do
hash
=
{
'author'
=>
{
'public_email'
=>
user
.
email
shared_examples
'updates provided reference'
do
|
reference
|
let
(
:hash
)
do
{
'author'
=>
{
'public_email'
=>
user
.
email
}
}
}
end
transformer
=
described_class
.
new
(
reference:
'author'
)
result
=
transformer
.
transform
(
context
,
hash
)
it
'updates provided reference'
do
transformer
=
described_class
.
new
(
reference:
reference
)
result
=
transformer
.
transform
(
context
,
hash
)
expect
(
result
[
'author'
]).
to
be_nil
expect
(
result
[
'author_id'
]).
to
eq
(
user
.
id
)
expect
(
result
[
'author'
]).
to
be_nil
expect
(
result
[
'author_id'
]).
to
eq
(
user
.
id
)
end
end
include_examples
'updates provided reference'
,
'author'
include_examples
'updates provided reference'
,
:author
end
end
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