# 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
# 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 = {
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
+++ /dev/null
-# frozen_string_literal: true
-class Foo < ActiveRecord::Base
-end
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
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
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