summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2023-12-17 15:05:47 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2023-12-17 15:05:47 +0000
commite566e60e51a740387261a06fe800fefece750fb1 (patch)
tree5cd940235f90af265d85573518f25a8beebe1bc2 /test
parent4cc0b8d2ca80f4de3a0217184e9ef982f2407c05 (diff)
downloadredmine-e566e60e51a740387261a06fe800fefece750fb1.tar.gz
redmine-e566e60e51a740387261a06fe800fefece750fb1.zip
Adds test for plugin autoload issue (#36320, #39834).
Patch by @tohosaku. git-svn-id: https://svn.redmine.org/redmine/trunk@22522 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/autoload/plugin_autoload_test.rb27
-rw-r--r--test/fixtures/plugins/foo_plugin/app/models/foo.rb3
2 files changed, 30 insertions, 0 deletions
diff --git a/test/autoload/plugin_autoload_test.rb b/test/autoload/plugin_autoload_test.rb
new file mode 100644
index 000000000..76a1983d2
--- /dev/null
+++ b/test/autoload/plugin_autoload_test.rb
@@ -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
diff --git a/test/fixtures/plugins/foo_plugin/app/models/foo.rb b/test/fixtures/plugins/foo_plugin/app/models/foo.rb
new file mode 100644
index 000000000..0152b6e1a
--- /dev/null
+++ b/test/fixtures/plugins/foo_plugin/app/models/foo.rb
@@ -0,0 +1,3 @@
+# frozen_string_literal: true
+class Foo < ActiveRecord::Base
+end