diff options
author | James Lopez <james@jameslopez.es> | 2016-09-01 17:59:36 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-09-09 14:56:10 +0200 |
commit | 13a977475aa813636c31f606e93ee2cc1a9e8d75 (patch) | |
tree | 88abf3222c900477800801221f142265bccc32c4 /spec/support/import_export | |
parent | 74cefffd067a90fc25f8c64c40f57c484785c5d0 (diff) | |
download | gitlab-ce-13a977475aa813636c31f606e93ee2cc1a9e8d75.tar.gz |
add model configuration spec to check for new models. Also refactored attribute_configuration spec
Diffstat (limited to 'spec/support/import_export')
-rw-r--r-- | spec/support/import_export/configuration_helper.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/support/import_export/configuration_helper.rb b/spec/support/import_export/configuration_helper.rb new file mode 100644 index 00000000000..fec83765253 --- /dev/null +++ b/spec/support/import_export/configuration_helper.rb @@ -0,0 +1,15 @@ +module ConfigurationHelper + # Returns a list of models from hashes/arrays contained in +project_tree+ + def names_from_tree(project_tree) + project_tree.map do |branch_or_model| + branch_or_model = branch_or_model.to_s if branch_or_model.is_a?(Symbol) + + branch_or_model.is_a?(String) ? branch_or_model : names_from_tree(branch_or_model) + end + end + + def relation_class_for_name(relation_name) + relation_name = Gitlab::ImportExport::RelationFactory::OVERRIDES[relation_name.to_sym] || relation_name + relation_name.to_s.classify.constantize + end +end |