diff options
author | James Lopez <james@jameslopez.es> | 2016-10-26 18:44:11 +0100 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-11-01 14:40:23 +0000 |
commit | a23ca284c720755dbfc1d2f0138c0fa3ad073b9d (patch) | |
tree | 6d4d64305527eb26d7154ced2b0629cc4faab0ca /spec/lib | |
parent | 912e1ff4284eb39fe020b8e823085a2cb7f244fb (diff) | |
download | gitlab-ce-a23ca284c720755dbfc1d2f0138c0fa3ad073b9d.tar.gz |
Fixed Import/Export foreign key issue to do with project members
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/import_export/attribute_cleaner_spec.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/lib/gitlab/import_export/attribute_cleaner_spec.rb b/spec/lib/gitlab/import_export/attribute_cleaner_spec.rb new file mode 100644 index 00000000000..63bab0f0d0d --- /dev/null +++ b/spec/lib/gitlab/import_export/attribute_cleaner_spec.rb @@ -0,0 +1,37 @@ +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, + 'ci_id' => 99, + 'random_project_id' => 99, + 'random_id' => 99, + 'milestone_id' => 99, + 'project_id' => 99, + 'user_id' => 99, + 'random_id_in_the_middle' => 99, + 'notid' => 99 + } + end + + let(:post_safe_hash) do + { + 'project_id' => 99, + 'user_id' => 99, + 'random_id_in_the_middle' => 99, + 'notid' => 99 + } + end + + it 'removes unwanted attributes from the hash' do + # allow(relation_class).to receive(:attribute_method?).and_return(true) + parsed_hash = described_class.clean(relation_hash: unsafe_hash, relation_class: relation_class) + + expect(parsed_hash).to eq(post_safe_hash) + end +end |