DEV: Fix the enable_current_plugin spec helper

Some plugins are always enabled and don’t have a related site setting.
This patch takes this into account.
This commit is contained in:
Loïc Guitaut
2025-04-02 12:14:17 +02:00
committed by Loïc Guitaut
parent 116a72504b
commit c96e7aa723

View File

@ -309,9 +309,9 @@ module Helpers
end end
def enable_current_plugin def enable_current_plugin
setting_name = plugin = Discourse.plugins_by_name[directory_from_caller.split("/").last]
Discourse.plugins_by_name[directory_from_caller.split("/").last].enabled_site_setting return if plugin.enabled?
SiteSetting.public_send("#{setting_name}=", true) SiteSetting.public_send("#{plugin.enabled_site_setting}=", true)
end end
private private