Commit e8396d8e authored by James Lopez's avatar James Lopez

fix member mapper spec

parent e8a9682b
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
......
...@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment