From 4bd8a427d4e8127f1badc7365b35702472918956 Mon Sep 17 00:00:00 2001 From: Tiago Botelho Date: Tue, 27 Nov 2018 09:41:27 +0000 Subject: Removes all the irrelevant import related code and columns Clears the import related columns and code from the Project model over to the ProjectImportState model --- spec/factories/import_state.rb | 7 ++++++- spec/factories/projects.rb | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'spec/factories') diff --git a/spec/factories/import_state.rb b/spec/factories/import_state.rb index 15d0a9d466a..d6de26dccbc 100644 --- a/spec/factories/import_state.rb +++ b/spec/factories/import_state.rb @@ -5,6 +5,7 @@ FactoryBot.define do transient do import_url { generate(:url) } + import_type nil end trait :repository do @@ -32,7 +33,11 @@ FactoryBot.define do end after(:create) do |import_state, evaluator| - import_state.project.update_columns(import_url: evaluator.import_url) + columns = {} + columns[:import_url] = evaluator.import_url unless evaluator.import_url.blank? + columns[:import_type] = evaluator.import_type unless evaluator.import_type.blank? + + import_state.project.update_columns(columns) end end end diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index e4823a5adf1..1906c06a211 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -30,6 +30,8 @@ FactoryBot.define do # we can't assign the delegated `#ci_cd_settings` attributes directly, as the # `#ci_cd_settings` relation needs to be created first group_runners_enabled nil + import_status nil + import_jid nil end after(:create) do |project, evaluator| @@ -64,6 +66,13 @@ FactoryBot.define do # assign the delegated `#ci_cd_settings` attributes after create project.reload.group_runners_enabled = evaluator.group_runners_enabled unless evaluator.group_runners_enabled.nil? + + if evaluator.import_status + import_state = project.import_state || project.build_import_state + import_state.status = evaluator.import_status + import_state.jid = evaluator.import_jid + import_state.save + end end trait :public do -- cgit v1.2.1