From 609df3368032fd4ac7e88d0e1d18aab9d7ed2659 Mon Sep 17 00:00:00 2001 From: merefield Date: Tue, 18 Jul 2023 14:29:39 +0100 Subject: [PATCH] downcase name for category cstm setting --- lib/custom_wizard/template.rb | 2 +- spec/requests/custom_wizard/admin/wizard_controller_spec.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/custom_wizard/template.rb b/lib/custom_wizard/template.rb index 9fa197f7..aa4e2fcd 100644 --- a/lib/custom_wizard/template.rb +++ b/lib/custom_wizard/template.rb @@ -64,7 +64,7 @@ class CustomWizard::Template ensure_wizard_upload_references!(wizard_id) PluginStore.remove(CustomWizard::PLUGIN_NAME, wizard.id) clear_user_wizard_redirect(wizard_id, after_time: !!wizard.after_time) - related_custom_fields = CategoryCustomField.where(name: 'create_topic_wizard', value: wizard.name.parameterize.underscore) + related_custom_fields = CategoryCustomField.where(name: 'create_topic_wizard', value: wizard.name.parameterize.underscore.downcase) related_custom_fields.destroy_all end diff --git a/spec/requests/custom_wizard/admin/wizard_controller_spec.rb b/spec/requests/custom_wizard/admin/wizard_controller_spec.rb index 7986f565..2ec2da10 100644 --- a/spec/requests/custom_wizard/admin/wizard_controller_spec.rb +++ b/spec/requests/custom_wizard/admin/wizard_controller_spec.rb @@ -5,7 +5,7 @@ describe CustomWizard::AdminWizardController do fab!(:user1) { Fabricate(:user) } fab!(:user2) { Fabricate(:user) } let(:template) { get_wizard_fixture("wizard") } - let(:category) { Fabricate(:category, custom_fields: { create_topic_wizard: template['name'].parameterize.underscore }) } + let(:category) { Fabricate(:category, custom_fields: { create_topic_wizard: template['name'].parameterize.underscore.downcase }) } before do CustomWizard::Template.save(template, skip_jobs: true) @@ -41,11 +41,11 @@ describe CustomWizard::AdminWizardController do end it "removes wizard templates whilst making sure create_topic_wizard settings for that wizard are removed from Categories" do - expect(CategoryCustomField.find_by(category_id: category.id, name: 'create_topic_wizard', value: template['name'].parameterize.underscore)).not_to eq(nil) + expect(CategoryCustomField.find_by(category_id: category.id, name: 'create_topic_wizard', value: template['name'].parameterize.underscore.downcase)).not_to eq(nil) delete "/admin/wizards/wizard/#{template['id']}.json" expect(response.status).to eq(200) expect(CustomWizard::Template.exists?(template['id'])).to eq(false) - expect(CategoryCustomField.find_by(name: 'create_topic_wizard', value: template['name'].parameterize.underscore)).to eq(nil) + expect(CategoryCustomField.find_by(name: 'create_topic_wizard', value: template['name'].parameterize.underscore.downcase)).to eq(nil) end it "saves wizard templates" do