diff --git a/lib/data_update_scripts/20201229230456_remove_collective_noun_from_site_config.rb b/lib/data_update_scripts/20201229230456_remove_collective_noun_from_site_config.rb new file mode 100644 index 000000000..4e9360105 --- /dev/null +++ b/lib/data_update_scripts/20201229230456_remove_collective_noun_from_site_config.rb @@ -0,0 +1,7 @@ +module DataUpdateScripts + class RemoveCollectiveNounFromSiteConfig + def run + SiteConfig.where(var: %w[collective_noun collective_noun_disabled]).destroy_all + end + end +end diff --git a/spec/lib/data_update_scripts/remove_collective_noun_from_site_config_spec.rb b/spec/lib/data_update_scripts/remove_collective_noun_from_site_config_spec.rb new file mode 100644 index 000000000..12b627845 --- /dev/null +++ b/spec/lib/data_update_scripts/remove_collective_noun_from_site_config_spec.rb @@ -0,0 +1,18 @@ +require "rails_helper" +require Rails.root.join( + "lib/data_update_scripts/20201229230456_remove_collective_noun_from_site_config.rb", +) + +describe DataUpdateScripts::RemoveCollectiveNounFromSiteConfig do + context "when collective_noun and collective_noun_disabled are removed from the Config" do + it "does not alter the community_name" do + allow(SiteConfig).to receive(:community_name).and_return("DEV Club") + + expect do + described_class.new.run + end.not_to change(SiteConfig, :community_name) + + expect(SiteConfig.community_name).to eq("DEV Club") + end + end +end