[Hotfix] Fix DataUpdateScripts::RemoveSiteConfigScripts script (#13824)

This commit is contained in:
rhymes 2021-05-21 16:34:21 +02:00 committed by GitHub
parent 6dfabd578f
commit cfff766d37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View file

@ -11,7 +11,7 @@ module DataUpdateScripts
].freeze
def run
DataUpdateScript.delete_by(name: SCRIPTS_TO_REMOVE)
DataUpdateScript.delete_by(file_name: SCRIPTS_TO_REMOVE)
end
end
end

View file

@ -0,0 +1,18 @@
require "rails_helper"
require Rails.root.join(
"lib/data_update_scripts/20210518043957_remove_site_config_scripts.rb",
)
describe DataUpdateScripts::RemoveSiteConfigScripts do
it "removes scripts correctly from the DB", :aggregate_failures do
described_class::SCRIPTS_TO_REMOVE.each do |script_name|
create(:data_update_script, file_name: script_name)
end
described_class.new.run
described_class::SCRIPTS_TO_REMOVE.each do |script_name|
expect(DataUpdateScript.exists?(file_name: script_name)).to be(false)
end
end
end