Patch #31110 » 0002-Change-to-raise-an-exception.patch
lib/redmine/plugin.rb | ||
---|---|---|
98 | 98 |
# Set a default directory if it was not provided during registration |
99 | 99 |
p.directory(File.join(self.directory, id.to_s)) if p.directory.nil? |
100 | 100 | |
101 |
unless File.directory?(p.directory) |
|
102 |
raise PluginNotFound.new("Plugin not found: #{p.directory}") |
|
103 |
end |
|
104 | ||
101 | 105 |
# Adds plugin locales if any |
102 | 106 |
# YAML translation files should be found under <plugin>/config/locales/ |
103 | 107 |
Rails.application.config.i18n.load_path += Dir.glob(File.join(p.directory, 'config', 'locales', '*.yml')) |
test/unit/lib/redmine/plugin_test.rb | ||
---|---|---|
57 | 57 |
assert_equal '0.0.1', plugin.version |
58 | 58 |
end |
59 | 59 | |
60 |
def test_register_should_raise_error_if_plugin_directory_does_not_exist |
|
61 |
e = assert_raises Redmine::PluginNotFound do |
|
62 |
@klass.register(:bar_plugin) {} |
|
63 |
end |
|
64 | ||
65 |
assert_equal "Plugin not found: #{Rails.root.join('test/fixtures/plugins/bar_plugin')}", e.message |
|
66 |
end |
|
67 | ||
60 | 68 |
def test_installed |
61 | 69 |
@klass.register(:foo_plugin) {} |
62 | 70 |
assert_equal true, @klass.installed?(:foo_plugin) |