Commit 5b17ff09 authored by nmilojevic1's avatar nmilojevic1 Committed by Stan Hu

Move common methods to configuration_helper

parent 57dfc84f
...@@ -12,8 +12,6 @@ describe 'Import/Export - project export integration test', :js do ...@@ -12,8 +12,6 @@ describe 'Import/Export - project export integration test', :js do
let(:user) { create(:admin) } let(:user) { create(:admin) }
let(:export_path) { "#{Dir.tmpdir}/import_file_spec" } let(:export_path) { "#{Dir.tmpdir}/import_file_spec" }
let(:config_hash) { Gitlab::ImportExport::Config.new.to_h.deep_stringify_keys }
let(:sensitive_words) { %w[pass secret token key encrypted html] } let(:sensitive_words) { %w[pass secret token key encrypted html] }
let(:safe_list) do let(:safe_list) do
{ {
......
...@@ -12,16 +12,6 @@ require 'spec_helper' ...@@ -12,16 +12,6 @@ require 'spec_helper'
describe 'Import/Export attribute configuration' do describe 'Import/Export attribute configuration' do
include ConfigurationHelper include ConfigurationHelper
let(:config_hash) { Gitlab::ImportExport::Config.new.to_h.deep_stringify_keys }
let(:relation_names) do
names = names_from_tree(config_hash.dig('tree', 'project'))
# Remove duplicated or add missing models
# - project is not part of the tree, so it has to be added manually.
# - milestone, labels have both singular and plural versions in the tree, so remove the duplicates.
names.flatten.uniq - %w(milestones labels) + ['project']
end
let(:safe_attributes_file) { 'spec/lib/gitlab/import_export/safe_model_attributes.yml' } let(:safe_attributes_file) { 'spec/lib/gitlab/import_export/safe_model_attributes.yml' }
let(:safe_model_attributes) { YAML.load_file(safe_attributes_file) } let(:safe_model_attributes) { YAML.load_file(safe_attributes_file) }
......
...@@ -8,19 +8,10 @@ require 'spec_helper' ...@@ -8,19 +8,10 @@ require 'spec_helper'
describe 'Import/Export model configuration' do describe 'Import/Export model configuration' do
include ConfigurationHelper include ConfigurationHelper
let(:config_hash) { Gitlab::ImportExport::Config.new.to_h.deep_stringify_keys }
let(:model_names) do
names = names_from_tree(config_hash.dig('tree', 'project'))
# Remove duplicated or add missing models
# - project is not part of the tree, so it has to be added manually.
# - milestone, labels, merge_request have both singular and plural versions in the tree, so remove the duplicates.
# - User, Author... Models we do not care about for checking models
names.flatten.uniq - %w(milestones labels user author merge_request) + ['project']
end
let(:all_models_yml) { 'spec/lib/gitlab/import_export/all_models.yml' } let(:all_models_yml) { 'spec/lib/gitlab/import_export/all_models.yml' }
let(:all_models_hash) { YAML.load_file(all_models_yml) } let(:all_models_hash) { YAML.load_file(all_models_yml) }
let(:current_models) { setup_models } let(:current_models) { setup_models }
let(:model_names) { relation_names }
it 'has no new models' do it 'has no new models' do
model_names.each do |model_name| model_names.each do |model_name|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment