Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-09-01 18:59:36 +0300
committerJames Lopez <james@jameslopez.es>2016-09-09 15:56:10 +0300
commit13a977475aa813636c31f606e93ee2cc1a9e8d75 (patch)
tree88abf3222c900477800801221f142265bccc32c4 /spec/lib/gitlab/import_export/attribute_configuration_spec.rb
parent74cefffd067a90fc25f8c64c40f57c484785c5d0 (diff)
add model configuration spec to check for new models. Also refactored attribute_configuration spec
Diffstat (limited to 'spec/lib/gitlab/import_export/attribute_configuration_spec.rb')
-rw-r--r--spec/lib/gitlab/import_export/attribute_configuration_spec.rb16
1 files changed, 2 insertions, 14 deletions
diff --git a/spec/lib/gitlab/import_export/attribute_configuration_spec.rb b/spec/lib/gitlab/import_export/attribute_configuration_spec.rb
index 336da93c782..931b27ffb24 100644
--- a/spec/lib/gitlab/import_export/attribute_configuration_spec.rb
+++ b/spec/lib/gitlab/import_export/attribute_configuration_spec.rb
@@ -7,6 +7,8 @@ require 'spec_helper'
# Likewise, new models added to import_export.yml, will need to be added with their correspondent attributes
# to this spec.
describe 'Attribute configuration', lib: true do
+ include ConfigurationHelper
+
let(:config_hash) { YAML.load_file(Gitlab::ImportExport.config_file).deep_stringify_keys }
let(:relation_names) do
names = names_from_tree(config_hash['project_tree'])
@@ -58,20 +60,6 @@ describe 'Attribute configuration', lib: true do
end
end
- # 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
-
def failure_message(relation_class, new_attributes)
<<-MSG
It looks like #{relation_class}, which is exported using the project Import/Export, has new attributes: #{new_attributes.join(',')}