From 495397793e1530bb1ec453d1ae5ea9b77cd22c54 Mon Sep 17 00:00:00 2001 From: James Lopez <james@jameslopez.es> Date: Tue, 12 Apr 2016 12:57:00 +0200 Subject: [PATCH] fix spec --- .../projects/import_export/project_tree_restorer.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/services/projects/import_export/project_tree_restorer.rb b/app/services/projects/import_export/project_tree_restorer.rb index df0363e0eca..251221c2a6f 100644 --- a/app/services/projects/import_export/project_tree_restorer.rb +++ b/app/services/projects/import_export/project_tree_restorer.rb @@ -23,16 +23,18 @@ module Projects end def create_relations(relation_list = default_relation_list, tree_hash = @tree_hash) + saved = [] relation_list.each do |relation| if relation.is_a?(Hash) create_sub_relations(relation, tree_hash) end relation_key = relation.is_a?(Hash) ? relation.keys.first : relation relation_hash = create_relation(relation_key, tree_hash[relation_key.to_s]) - project.update_attribute(relation_key, relation_hash) + saved << project.update_attribute(relation_key, relation_hash) # FIXME # next if tree_hash[relation.to_s].blank? end + saved.all? end def default_relation_list @@ -56,7 +58,7 @@ module Projects relation.values.flatten.each do |sub_relation| relation_hash = relation_item[sub_relation.to_s] next if relation_hash.blank? - sub_relation_object = relation_from_factory(relation, relation_hash) + sub_relation_object = relation_from_factory(sub_relation, relation_hash) relation_item[sub_relation.to_s] = sub_relation_object end end -- GitLab