few fixes to import specs and code

This commit is contained in:
James Lopez 2016-05-06 15:18:25 +02:00
parent 4290e9c8dd
commit 49cdb778a1
4 changed files with 7 additions and 6 deletions

View file

@ -14,7 +14,8 @@ module Gitlab
@tree_hash = ActiveSupport::JSON.decode(json)
@project_members = @tree_hash.delete('project_members')
create_relations
rescue
rescue => e
# TODO: handle errors better, move them to a shared thing
false
end
@ -83,7 +84,7 @@ module Gitlab
def relation_from_factory(relation, relation_hash)
Gitlab::ImportExport::RelationFactory.create(
relation_sym: relation, relation_hash: relation_hash.merge('project_id' => project.id), members_map: members_map)
relation_sym: relation.to_sym, relation_hash: relation_hash.merge('project_id' => project.id), members_map: members_map)
end
end
end

View file

@ -1,7 +1,7 @@
require 'spec_helper'
describe Gitlab::ImportExport::MembersMapper, services: true do
describe :map do
describe 'map members' do
let(:user) { create(:user) }
let(:project) { create(:project, :public, name: 'searchable_project') }
@ -31,7 +31,7 @@ describe Gitlab::ImportExport::MembersMapper, services: true do
end
let(:members_mapper) do
Gitlab::ImportExport::MembersMapper.new(
described_class.new(
exported_members: exported_members, user: user, project_id: project.id)
end

View file

@ -1,11 +1,11 @@
require 'spec_helper'
describe Gitlab::ImportExport::ProjectTreeRestorer, services: true do
describe :restore do
describe 'restore project tree' do
let(:user) { create(:user) }
let(:namespace) { create(:namespace, owner: user) }
let(:project_tree_restorer) { Gitlab::ImportExport::ProjectTreeRestorer.new(path: "lib/gitlab/import_export/", user: user, project_path: 'project', namespace_id: namespace.id) }
let(:project_tree_restorer) { described_class.new(path: Rails.root.join("spec/lib/gitlab/import_export/"), user: user, project_path: 'project', namespace_id: namespace.id) }
context 'JSON' do
let(:restored_project_json) do