]> source.dussan.org Git - redmine.git/commitdiff
Update integration test for plugin routes after r22515 (#36320, #39803).
authorMarius Balteanu <marius.balteanu@zitec.com>
Tue, 12 Dec 2023 16:45:43 +0000 (16:45 +0000)
committerMarius Balteanu <marius.balteanu@zitec.com>
Tue, 12 Dec 2023 16:45:43 +0000 (16:45 +0000)
git-svn-id: https://svn.redmine.org/redmine/trunk@22516 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/integration/routing/plugins_test.rb

index 53b10cd0afa4ce88efc1f07c6f2729abe3dfc3ff..0124e759fba98c17af3f52004b45542b2342afc4 100644 (file)
 require File.expand_path('../../test_helper', __dir__)
 
 class RoutingPluginsTest < Redmine::RoutingTest
+  def setup
+    @original_plugin_dir = Redmine::PluginLoader.directory
+
+    Redmine::Plugin.clear
+    Redmine::PluginLoader.directory = Rails.root.join('test/fixtures/plugins')
+    Redmine::Plugin.directory = Rails.root.join('test/fixtures/plugins')
+    Redmine::PluginLoader.load
+    Redmine::PluginLoader.directories.each(&:run_initializer) # to define relative controllers
+    RedmineApp::Application.instance.routes_reloader.reload!
+  end
+
+  def teardown
+    Redmine::Plugin.clear
+    Redmine::PluginLoader.directory = @original_plugin_dir
+    Redmine::Plugin.directory = @original_plugin_dir
+    Redmine::PluginLoader.load
+    RedmineApp::Application.instance.routes_reloader.reload!
+  end
+
   def test_plugins
     should_route 'GET /plugin_articles' => 'plugin_articles#index'
     should_route 'GET /bar_plugin_articles' => 'bar_plugin_articles#index'