From bfe6121ef3d5bf2d9889ec16eae624e66174d4e0 Mon Sep 17 00:00:00 2001 From: Marius Balteanu Date: Tue, 24 Oct 2023 20:06:54 +0000 Subject: [PATCH] Fixes a random failing test in @test_plugins@ (integration/routing/plugins_test.rb) by enforcing the plugins path to @tmp/plugins@ (#38707). git-svn-id: https://svn.redmine.org/redmine/trunk@22373 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/integration/routing/plugins_test.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/integration/routing/plugins_test.rb b/test/integration/routing/plugins_test.rb index 74ecfcb98..b330ec654 100644 --- a/test/integration/routing/plugins_test.rb +++ b/test/integration/routing/plugins_test.rb @@ -21,6 +21,8 @@ require File.expand_path('../../test_helper', __dir__) class RoutingPluginsTest < Redmine::RoutingTest setup do + @tmp_plugins_path = Rails.root.join('tmp/test/plugins') + @setup_plugin_paths = [] @setup_plugin_paths << setup_plugin( :redmine_test_plugin_foo, @@ -49,6 +51,9 @@ class RoutingPluginsTest < Redmine::RoutingTest end CONTROLLER_CONTENT ) + + # Change plugin loader's directory for testing + Redmine::PluginLoader.directory = @tmp_plugins_path Redmine::PluginLoader.load Redmine::PluginLoader.directories.each(&:run_initializer) # to define relative controllers RedmineApp::Application.instance.routes_reloader.reload! @@ -69,7 +74,8 @@ class RoutingPluginsTest < Redmine::RoutingTest private def setup_plugin(plugin_name, **relative_path_to_content) - plugin_path = Redmine::Plugin.directory / plugin_name.to_s + Redmine::Plugin.directory = @tmp_plugins_path + plugin_path = Redmine::Plugin.directory / plugin_name.to_s plugin_path.mkpath (plugin_path / "init.rb").write(<<~INITRB) Redmine::Plugin.register :#{plugin_name} do -- 2.39.5