summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-10-27 10:22:18 +0000
committerRémy Coutable <remy@rymai.me>2016-11-03 16:04:18 +0100
commitcfb511ea692fedffbad5b6ee1a7638b1eb78a4d6 (patch)
tree4e4cbba1bd91f4ee6fd5e1de0cc8d16e17100d23 /spec/lib
parentc9578688c01be520862b3aedcf05e7233d3ac555 (diff)
downloadgitlab-ce-cfb511ea692fedffbad5b6ee1a7638b1eb78a4d6.tar.gz
Merge branch 'fix/import-projectmember-security' into 'security'
Fix Import/Export foreign key issue to do with project members Cleans-up any foreign keys in `ProjectMember` - same as we do with the rest of the models when importing. Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/23837 and https://gitlab.com/gitlab-org/gitlab-ce/issues/23739 See merge request !2020 Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/import_export/attribute_cleaner_spec.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/spec/lib/gitlab/import_export/attribute_cleaner_spec.rb b/spec/lib/gitlab/import_export/attribute_cleaner_spec.rb
index b8e7932eb4a..63bab0f0d0d 100644
--- a/spec/lib/gitlab/import_export/attribute_cleaner_spec.rb
+++ b/spec/lib/gitlab/import_export/attribute_cleaner_spec.rb
@@ -1,8 +1,10 @@
require 'spec_helper'
describe Gitlab::ImportExport::AttributeCleaner, lib: true do
+ let(:relation_class){ double('relation_class').as_null_object }
let(:unsafe_hash) do
{
+ 'id' => 101,
'service_id' => 99,
'moved_to_id' => 99,
'namespace_id' => 99,
@@ -27,8 +29,9 @@ describe Gitlab::ImportExport::AttributeCleaner, lib: true do
end
it 'removes unwanted attributes from the hash' do
- described_class.clean!(relation_hash: unsafe_hash)
+ # allow(relation_class).to receive(:attribute_method?).and_return(true)
+ parsed_hash = described_class.clean(relation_hash: unsafe_hash, relation_class: relation_class)
- expect(unsafe_hash).to eq(post_safe_hash)
+ expect(parsed_hash).to eq(post_safe_hash)
end
end