refactored some stuff and added new models / attributes after rebase
This commit is contained in:
parent
0f15e971fc
commit
37fbb15a29
|
@ -11,7 +11,6 @@ issues:
|
||||||
- labels
|
- labels
|
||||||
- todos
|
- todos
|
||||||
- user_agent_detail
|
- user_agent_detail
|
||||||
- project
|
|
||||||
- moved_to
|
- moved_to
|
||||||
- events
|
- events
|
||||||
events:
|
events:
|
||||||
|
@ -173,3 +172,4 @@ project:
|
||||||
- triggers
|
- triggers
|
||||||
- environments
|
- environments
|
||||||
- deployments
|
- deployments
|
||||||
|
- project_feature
|
|
@ -23,7 +23,7 @@ describe 'Import/Export model configuration', lib: true do
|
||||||
|
|
||||||
it 'has no new models' do
|
it 'has no new models' do
|
||||||
model_names.each do |model_name|
|
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)
|
expect(new_models).to be_empty, failure_message(model_name.classify, new_models)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -36,7 +36,7 @@ describe 'Import/Export model configuration', lib: true do
|
||||||
model_names.each do |model_name|
|
model_names.each do |model_name|
|
||||||
model_class = relation_class_for_name(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
|
end
|
||||||
|
|
||||||
all_models_hash
|
all_models_hash
|
||||||
|
|
|
@ -298,3 +298,13 @@ Project:
|
||||||
- archived
|
- archived
|
||||||
Author:
|
Author:
|
||||||
- name
|
- 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
|
|
@ -23,9 +23,7 @@ module ConfigurationHelper
|
||||||
attributes
|
attributes
|
||||||
end
|
end
|
||||||
|
|
||||||
def associations_for(model_class)
|
def associations_for(safe_model)
|
||||||
model_class.reflect_on_all_associations.map do |association|
|
safe_model.reflect_on_all_associations.map { |assoc| assoc.name.to_s }
|
||||||
association.name.to_s
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -120,10 +120,6 @@ module ExportFileHelper
|
||||||
false
|
false
|
||||||
end
|
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
|
# Compares model attributes with those those found in the hash
|
||||||
# and returns true if there is a match, ignoring some excluded attributes.
|
# and returns true if there is a match, ignoring some excluded attributes.
|
||||||
def safe_model?(model, excluded_attributes, parent)
|
def safe_model?(model, excluded_attributes, parent)
|
||||||
|
|
Loading…
Reference in New Issue