summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-09-07 10:04:20 +0200
committerJames Lopez <james@jameslopez.es>2016-09-09 14:56:10 +0200
commit37fbb15a2967523d41887f55b6f38e6d74bd6d7f (patch)
treea2aad9e59b9b95530f5f1383d9dc9ec09e16d77d
parent0f15e971fc8c06a4c76eaaad16abe4229816a676 (diff)
downloadgitlab-ce-37fbb15a2967523d41887f55b6f38e6d74bd6d7f.tar.gz
refactored some stuff and added new models / attributes after rebase
-rw-r--r--spec/lib/gitlab/import_export/all_models.yml2
-rw-r--r--spec/lib/gitlab/import_export/model_configuration_spec.rb4
-rw-r--r--spec/lib/gitlab/import_export/safe_model_attributes.yml10
-rw-r--r--spec/support/import_export/configuration_helper.rb6
-rw-r--r--spec/support/import_export/export_file_helper.rb4
5 files changed, 15 insertions, 11 deletions
diff --git a/spec/lib/gitlab/import_export/all_models.yml b/spec/lib/gitlab/import_export/all_models.yml
index 16ad3e1e599..30968ba2d5f 100644
--- a/spec/lib/gitlab/import_export/all_models.yml
+++ b/spec/lib/gitlab/import_export/all_models.yml
@@ -11,7 +11,6 @@ issues:
- labels
- todos
- user_agent_detail
-- project
- moved_to
- events
events:
@@ -173,3 +172,4 @@ project:
- triggers
- environments
- deployments
+- project_feature \ No newline at end of file
diff --git a/spec/lib/gitlab/import_export/model_configuration_spec.rb b/spec/lib/gitlab/import_export/model_configuration_spec.rb
index 38e9edc4aab..9b492d1b9c7 100644
--- a/spec/lib/gitlab/import_export/model_configuration_spec.rb
+++ b/spec/lib/gitlab/import_export/model_configuration_spec.rb
@@ -23,7 +23,7 @@ describe 'Import/Export model configuration', lib: true do
it 'has no new models' do
model_names.each do |model_name|
- new_models = current_models[model_name] - all_models[model_name]
+ new_models = Array(current_models[model_name]) - Array(all_models[model_name])
expect(new_models).to be_empty, failure_message(model_name.classify, new_models)
end
end
@@ -36,7 +36,7 @@ describe 'Import/Export model configuration', lib: true do
model_names.each do |model_name|
model_class = relation_class_for_name(model_name)
- all_models_hash[model_name] = associations_for(model_class)
+ all_models_hash[model_name] = associations_for(model_class) - ['project']
end
all_models_hash
diff --git a/spec/lib/gitlab/import_export/safe_model_attributes.yml b/spec/lib/gitlab/import_export/safe_model_attributes.yml
index f7baf6a19cc..f2d272ca7e2 100644
--- a/spec/lib/gitlab/import_export/safe_model_attributes.yml
+++ b/spec/lib/gitlab/import_export/safe_model_attributes.yml
@@ -298,3 +298,13 @@ Project:
- archived
Author:
- name
+ProjectFeature:
+- id
+- project_id
+- merge_requests_access_level
+- issues_access_level
+- wiki_access_level
+- snippets_access_level
+- builds_access_level
+- created_at
+- updated_at \ No newline at end of file
diff --git a/spec/support/import_export/configuration_helper.rb b/spec/support/import_export/configuration_helper.rb
index 3276313df51..f752508d48c 100644
--- a/spec/support/import_export/configuration_helper.rb
+++ b/spec/support/import_export/configuration_helper.rb
@@ -23,9 +23,7 @@ module ConfigurationHelper
attributes
end
- def associations_for(model_class)
- model_class.reflect_on_all_associations.map do |association|
- association.name.to_s
- end
+ def associations_for(safe_model)
+ safe_model.reflect_on_all_associations.map { |assoc| assoc.name.to_s }
end
end
diff --git a/spec/support/import_export/export_file_helper.rb b/spec/support/import_export/export_file_helper.rb
index de066f1cd66..7e75ed9793b 100644
--- a/spec/support/import_export/export_file_helper.rb
+++ b/spec/support/import_export/export_file_helper.rb
@@ -120,10 +120,6 @@ module ExportFileHelper
false
end
- def associations_for(safe_model)
- safe_model.reflect_on_all_associations.map { |assoc| assoc.name.to_s }
- end
-
# Compares model attributes with those those found in the hash
# and returns true if there is a match, ignoring some excluded attributes.
def safe_model?(model, excluded_attributes, parent)