Project

General

Profile

Patch #31110 » 0002-Change-to-raise-an-exception.patch

Mizuki ISHIKAWA, 2019-03-28 08:08

View differences:

lib/redmine/plugin.rb
# 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.new("Plugin not found: #{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'))
test/unit/lib/redmine/plugin_test.rb
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: #{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)
(2-2/3)