From c96e7aa723dbcac0230efb83e78c6ec0244869c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Guitaut?= Date: Wed, 2 Apr 2025 12:14:17 +0200 Subject: [PATCH] DEV: Fix the `enable_current_plugin` spec helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some plugins are always enabled and don’t have a related site setting. This patch takes this into account. --- spec/support/helpers.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index ee345027b31..43682427419 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -309,9 +309,9 @@ module Helpers end def enable_current_plugin - setting_name = - Discourse.plugins_by_name[directory_from_caller.split("/").last].enabled_site_setting - SiteSetting.public_send("#{setting_name}=", true) + plugin = Discourse.plugins_by_name[directory_from_caller.split("/").last] + return if plugin.enabled? + SiteSetting.public_send("#{plugin.enabled_site_setting}=", true) end private