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
Boxiang Sun
gitlab-ce
Commits
e8396d8e
Commit
e8396d8e
authored
Jan 20, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix member mapper spec
parent
e8a9682b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
26 deletions
+1
-26
lib/gitlab/import_export/members_mapper.rb
lib/gitlab/import_export/members_mapper.rb
+0
-2
spec/lib/gitlab/import_export/members_mapper_spec.rb
spec/lib/gitlab/import_export/members_mapper_spec.rb
+1
-24
No files found.
lib/gitlab/import_export/members_mapper.rb
View file @
e8396d8e
module
Gitlab
module
Gitlab
module
ImportExport
module
ImportExport
class
MembersMapper
class
MembersMapper
attr_reader
:missing_author_ids
def
initialize
(
exported_members
:,
user
:,
project
:)
def
initialize
(
exported_members
:,
user
:,
project
:)
@exported_members
=
user
.
admin?
?
exported_members
:
[]
@exported_members
=
user
.
admin?
?
exported_members
:
[]
@user
=
user
@user
=
user
...
...
spec/lib/gitlab/import_export/members_mapper_spec.rb
View file @
e8396d8e
...
@@ -49,8 +49,6 @@ describe Gitlab::ImportExport::MembersMapper, services: true do
...
@@ -49,8 +49,6 @@ describe Gitlab::ImportExport::MembersMapper, services: true do
end
end
it
'includes the exported user ID in the map'
do
it
'includes the exported user ID in the map'
do
members_mapper
.
map
[
-
1
]
expect
(
members_mapper
.
map
.
keys
).
to
include
(
exported_user_id
)
expect
(
members_mapper
.
map
.
keys
).
to
include
(
exported_user_id
)
end
end
...
@@ -88,28 +86,7 @@ describe Gitlab::ImportExport::MembersMapper, services: true do
...
@@ -88,28 +86,7 @@ describe Gitlab::ImportExport::MembersMapper, services: true do
end
end
context
'chooses the one with an email first'
do
context
'chooses the one with an email first'
do
before
do
let
(
:user3
)
{
create
(
:user
,
username:
'test'
)
}
exported_members
<<
{
"id"
=>
2
,
"access_level"
=>
40
,
"source_id"
=>
14
,
"source_type"
=>
"Project"
,
"user_id"
=>
19
,
"notification_level"
=>
3
,
"created_at"
=>
"2016-03-11T10:21:44.822Z"
,
"updated_at"
=>
"2016-03-11T10:21:44.822Z"
,
"created_by_id"
=>
nil
,
"invite_email"
=>
nil
,
"invite_token"
=>
nil
,
"invite_accepted_at"
=>
nil
,
"user"
=>
{
"id"
=>
exported_user_id
,
"email"
=>
'test@email.com'
,
"username"
=>
user2
.
username
}
}
end
it
'maps the project member that has a matching email first'
do
it
'maps the project member that has a matching email first'
do
expect
(
members_mapper
.
map
[
exported_user_id
]).
to
eq
(
user2
.
id
)
expect
(
members_mapper
.
map
[
exported_user_id
]).
to
eq
(
user2
.
id
)
...
...
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