diff options
author | Marius Balteanu <marius.balteanu@zitec.com> | 2024-02-27 07:06:47 +0000 |
---|---|---|
committer | Marius Balteanu <marius.balteanu@zitec.com> | 2024-02-27 07:06:47 +0000 |
commit | 18cb44684b79d23dc1c45e4a9eeeb73dda5e9194 (patch) | |
tree | fabbf5c35715e1d1a5429c93b04aa5668487aad0 /test/unit | |
parent | 38d950df55ed1ed7180c0a9b25f47f18dee583da (diff) | |
download | redmine-18cb44684b79d23dc1c45e4a9eeeb73dda5e9194.tar.gz redmine-18cb44684b79d23dc1c45e4a9eeeb73dda5e9194.zip |
Introduces Redmine::Plugin#attachment_object_type to provide better API for registering plugin models having attachments (#39948, #39862).
Patch by Jens Krämer (@jkraemer).
git-svn-id: https://svn.redmine.org/redmine/trunk@22747 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/lib/redmine/plugin_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/unit/lib/redmine/plugin_test.rb b/test/unit/lib/redmine/plugin_test.rb index 1b53f7ebf..66865481b 100644 --- a/test/unit/lib/redmine/plugin_test.rb +++ b/test/unit/lib/redmine/plugin_test.rb @@ -62,6 +62,14 @@ class Redmine::PluginTest < ActiveSupport::TestCase assert_equal File.join(@klass.directory, 'foo_plugin', 'assets'), plugin.assets_directory end + ::FooModel = Class.new(ActiveRecord::Base) + def test_register_attachment_object_type + Redmine::Acts::Attachable::ObjectTypeConstraint.expects(:register_object_type).with("foo_models") + @klass.register :foo_plugin do + attachment_object_type FooModel + end + end + def test_register_should_raise_error_if_plugin_directory_does_not_exist e = assert_raises Redmine::PluginNotFound do @klass.register(:bar_plugin) {} |