mirror of
https://github.com/redmine/redmine.git
synced 2025-11-02 19:36:00 +01:00
Patch by @tohosaku. git-svn-id: https://svn.redmine.org/redmine/trunk@22522 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -85,6 +85,9 @@ module RedmineApp
|
|||||||
# for more options (same options as config.cache_store).
|
# for more options (same options as config.cache_store).
|
||||||
config.redmine_search_cache_store = :memory_store
|
config.redmine_search_cache_store = :memory_store
|
||||||
|
|
||||||
|
# Sets default plugin directory
|
||||||
|
config.redmine_plugins_directory = 'plugins'
|
||||||
|
|
||||||
# Configure log level here so that additional environment file
|
# Configure log level here so that additional environment file
|
||||||
# can change it (environments/ENV.rb would take precedence over it)
|
# can change it (environments/ENV.rb would take precedence over it)
|
||||||
config.log_level = Rails.env.production? ? :info : :debug
|
config.log_level = Rails.env.production? ? :info : :debug
|
||||||
|
|||||||
@@ -18,6 +18,12 @@ Rails.application.configure do
|
|||||||
# preloads Rails for running tests, you may have to set it to true.
|
# preloads Rails for running tests, you may have to set it to true.
|
||||||
config.eager_load = false
|
config.eager_load = false
|
||||||
|
|
||||||
|
# Change default plugins dir if env variable is present
|
||||||
|
# This is used by redmine plugins autoload test.
|
||||||
|
if ENV["REDMINE_PLUGINS_DIRECTORY"].present?
|
||||||
|
config.redmine_plugins_directory = ENV["REDMINE_PLUGINS_DIRECTORY"]
|
||||||
|
end
|
||||||
|
|
||||||
# Configure public file server for tests with Cache-Control for performance.
|
# Configure public file server for tests with Cache-Control for performance.
|
||||||
config.public_file_server.enabled = true
|
config.public_file_server.enabled = true
|
||||||
config.public_file_server.headers = {
|
config.public_file_server.headers = {
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ module Redmine
|
|||||||
class PluginLoader
|
class PluginLoader
|
||||||
# Absolute path to the directory where plugins are located
|
# Absolute path to the directory where plugins are located
|
||||||
cattr_accessor :directory
|
cattr_accessor :directory
|
||||||
self.directory = Rails.root.join('plugins')
|
self.directory = Rails.root.join Rails.application.config.redmine_plugins_directory
|
||||||
|
|
||||||
# Absolute path to the public directory where plugins assets are copied
|
# Absolute path to the public directory where plugins assets are copied
|
||||||
cattr_accessor :public_directory
|
cattr_accessor :public_directory
|
||||||
|
|||||||
@@ -114,4 +114,11 @@ namespace :test do
|
|||||||
Rails::TestUnit::Runner.run_from_rake 'test', FileList['test/integration/routing/*_test.rb'] + FileList['test/integration/api_test/*_routing_test.rb']
|
Rails::TestUnit::Runner.run_from_rake 'test', FileList['test/integration/routing/*_test.rb'] + FileList['test/integration/api_test/*_routing_test.rb']
|
||||||
end
|
end
|
||||||
Rake::Task['test:routing'].comment = "Run the routing tests"
|
Rake::Task['test:routing'].comment = "Run the routing tests"
|
||||||
|
|
||||||
|
task(:autoload) do |t|
|
||||||
|
$: << "test"
|
||||||
|
ENV["REDMINE_PLUGINS_DIRECTORY"] = "test/fixtures/plugins"
|
||||||
|
Rails::TestUnit::Runner.run_from_rake 'test', FileList['test/autoload/*_test.rb']
|
||||||
|
end
|
||||||
|
Rake::Task['test:autoload'].comment = "Run the plugin autoload tests"
|
||||||
end
|
end
|
||||||
|
|||||||
27
test/autoload/plugin_autoload_test.rb
Normal file
27
test/autoload/plugin_autoload_test.rb
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
# Redmine - project management software
|
||||||
|
# Copyright (C) 2006-2023 Jean-Philippe Lang
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
require_relative '../test_helper'
|
||||||
|
class Redmine::PluginAutoloadTest < ActiveSupport::TestCase
|
||||||
|
if ENV['REDMINE_PLUGINS_DIRECTORY']
|
||||||
|
def test_autoload
|
||||||
|
assert_equal true, Object.const_defined?(:Foo)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
puts 'Tests related to plugin autoloading should be run separately using "rails test:autoload"'
|
||||||
|
end
|
||||||
|
end
|
||||||
3
test/fixtures/plugins/foo_plugin/app/models/foo.rb
vendored
Normal file
3
test/fixtures/plugins/foo_plugin/app/models/foo.rb
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
class Foo < ActiveRecord::Base
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user