Patch by Mizuki ISHIKAWA. git-svn-id: http://svn.redmine.org/redmine/trunk@18064 e93f8b46-1217-0410-a6f0-8f06a7374b81tags/4.1.0
@@ -98,6 +98,10 @@ module Redmine | |||
# Set a default directory if it was not provided during registration | |||
p.directory(File.join(self.directory, id.to_s)) if p.directory.nil? | |||
unless File.directory?(p.directory) | |||
raise PluginNotFound, "Plugin not found. The directory for plugin #{p.id} should be #{p.directory}." | |||
end | |||
# Adds plugin locales if any | |||
# YAML translation files should be found under <plugin>/config/locales/ | |||
Rails.application.config.i18n.load_path += Dir.glob(File.join(p.directory, 'config', 'locales', '*.yml')) |
@@ -57,6 +57,14 @@ class Redmine::PluginTest < ActiveSupport::TestCase | |||
assert_equal '0.0.1', plugin.version | |||
end | |||
def test_register_should_raise_error_if_plugin_directory_does_not_exist | |||
e = assert_raises Redmine::PluginNotFound do | |||
@klass.register(:bar_plugin) {} | |||
end | |||
assert_equal "Plugin not found. The directory for plugin bar_plugin should be #{Rails.root.join('test/fixtures/plugins/bar_plugin')}.", e.message | |||
end | |||
def test_installed | |||
@klass.register(:foo_plugin) {} | |||
assert_equal true, @klass.installed?(:foo_plugin) |