summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2023-12-12 16:26:34 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2023-12-12 16:26:34 +0000
commita2c90c462f3ca011f51bffd03a01e560b9cf4c9b (patch)
tree44d1035e040c17ecf3c8cd63fdc45f0a0a3b3fe4
parent4cff8b309aac1dbfdfcd1930f1a50ca2e84d1747 (diff)
downloadredmine-a2c90c462f3ca011f51bffd03a01e560b9cf4c9b.tar.gz
redmine-a2c90c462f3ca011f51bffd03a01e560b9cf4c9b.zip
Reverts r22507, r22508 and r22510 (#36320, #39803).
git-svn-id: https://svn.redmine.org/redmine/trunk@22515 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--config/application.rb3
-rw-r--r--config/environments/test.rb3
-rw-r--r--lib/redmine/plugin_loader.rb2
-rw-r--r--test/fixtures/plugins/foo_plugin/app/models/foo.rb3
-rw-r--r--test/unit/lib/redmine/plugin_loader_test.rb7
-rw-r--r--test/unit/lib/redmine/plugin_test.rb5
6 files changed, 6 insertions, 17 deletions
diff --git a/config/application.rb b/config/application.rb
index f5062dfe7..48e855c9b 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -85,9 +85,6 @@ module RedmineApp
# for more options (same options as config.cache_store).
config.redmine_search_cache_store = :memory_store
- # Sets default plugin directory
- config.redmine_plugin_directory = 'plugins'
-
# Configure log level here so that additional environment file
# can change it (environments/ENV.rb would take precedence over it)
config.log_level = Rails.env.production? ? :info : :debug
diff --git a/config/environments/test.rb b/config/environments/test.rb
index e67cea76c..199f1bb27 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -18,9 +18,6 @@ Rails.application.configure do
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false
- # Change the plugin directory when testing to avoid clashes with real plugins.
- config.redmine_plugin_directory = 'test/fixtures/plugins'
-
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
diff --git a/lib/redmine/plugin_loader.rb b/lib/redmine/plugin_loader.rb
index 04d7e4af0..135df09ba 100644
--- a/lib/redmine/plugin_loader.rb
+++ b/lib/redmine/plugin_loader.rb
@@ -84,7 +84,7 @@ module Redmine
class PluginLoader
# Absolute path to the directory where plugins are located
cattr_accessor :directory
- self.directory = Rails.root.join Rails.application.config.redmine_plugin_directory
+ self.directory = Rails.root.join('plugins')
# Absolute path to the public directory where plugins assets are copied
cattr_accessor :public_directory
diff --git a/test/fixtures/plugins/foo_plugin/app/models/foo.rb b/test/fixtures/plugins/foo_plugin/app/models/foo.rb
deleted file mode 100644
index 0152b6e1a..000000000
--- a/test/fixtures/plugins/foo_plugin/app/models/foo.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-# frozen_string_literal: true
-class Foo < ActiveRecord::Base
-end
diff --git a/test/unit/lib/redmine/plugin_loader_test.rb b/test/unit/lib/redmine/plugin_loader_test.rb
index a0bec218e..ed5943346 100644
--- a/test/unit/lib/redmine/plugin_loader_test.rb
+++ b/test/unit/lib/redmine/plugin_loader_test.rb
@@ -23,9 +23,8 @@ class Redmine::PluginLoaderTest < ActiveSupport::TestCase
def setup
clear_public
- # Change plugin directory for testing to default in config/environments/tesr.rb.
- # plugins/foo => test/fixtures/plugins/foo
@klass = Redmine::PluginLoader
+ @klass.directory = Rails.root.join('test/fixtures/plugins')
@klass.public_directory = Rails.root.join('tmp/public/plugin_assets')
@klass.load
end
@@ -56,10 +55,6 @@ class Redmine::PluginLoaderTest < ActiveSupport::TestCase
assert File.exist?("#{@klass.public_directory}/foo_plugin/stylesheets/foo.css")
end
- def test_autoload
- assert_equal true, Object.const_defined?(:Foo)
- end
-
def clear_public
FileUtils.rm_rf 'tmp/public'
end
diff --git a/test/unit/lib/redmine/plugin_test.rb b/test/unit/lib/redmine/plugin_test.rb
index d27668247..02df23236 100644
--- a/test/unit/lib/redmine/plugin_test.rb
+++ b/test/unit/lib/redmine/plugin_test.rb
@@ -22,11 +22,14 @@ require_relative '../../../test_helper'
class Redmine::PluginTest < ActiveSupport::TestCase
def setup
@klass = Redmine::Plugin
- # Change plugin directory for testing to default in config/environments/test.rb.
+ # Change plugin directory for testing to default
# plugins/foo => test/fixtures/plugins/foo
+ @klass.directory = Rails.root.join('test/fixtures/plugins')
# In case some real plugins are installed
@klass.clear
+ # Change plugin loader's directory for testing
+ Redmine::PluginLoader.directory = @klass.directory
Redmine::PluginLoader.setup
end