diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-11-27 12:41:27 +0300 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-11-27 15:58:13 +0300 |
commit | 4bd8a427d4e8127f1badc7365b35702472918956 (patch) | |
tree | d8e64bd046f35b64ad6f88bdd062e1e8f364c327 /spec/factories | |
parent | d3f033d69cec33e8058ee9f029718882990175b0 (diff) |
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
Diffstat (limited to 'spec/factories')
-rw-r--r-- | spec/factories/import_state.rb | 7 | ||||
-rw-r--r-- | spec/factories/projects.rb | 9 |
2 files changed, 15 insertions, 1 deletions
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 |