diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-12-03 21:33:34 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-12-03 21:33:34 +0000 |
commit | a0a6571be31eb1f758941651d0d84391708bb915 (patch) | |
tree | deaf11d58f7d74020e9d597fb59aa6e5d69354bb /test | |
parent | 7362cd2e100d13117437502884ebb0a0568ecfdf (diff) | |
download | redmine-a0a6571be31eb1f758941651d0d84391708bb915.tar.gz redmine-a0a6571be31eb1f758941651d0d84391708bb915.zip |
Adds tests for plugin API.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8066 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/lib/redmine/plugin_test.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/unit/lib/redmine/plugin_test.rb b/test/unit/lib/redmine/plugin_test.rb index 4192a0250..198ea3967 100644 --- a/test/unit/lib/redmine/plugin_test.rb +++ b/test/unit/lib/redmine/plugin_test.rb @@ -53,6 +53,36 @@ class Redmine::PluginTest < ActiveSupport::TestCase assert_equal '0.0.1', plugin.version end + def test_installed + @klass.register(:foo) {} + + assert_equal true, @klass.installed?(:foo) + assert_equal false, @klass.installed?(:bar) + end + + def test_menu + assert_difference 'Redmine::MenuManager.items(:project_menu).size' do + @klass.register :foo do + menu :project_menu, :foo_menu_item, '/foo', :caption => 'Foo' + end + end + menu_item = Redmine::MenuManager.items(:project_menu).detect {|i| i.name == :foo_menu_item} + assert_not_nil menu_item + assert_equal 'Foo', menu_item.caption + assert_equal '/foo', menu_item.url + end + + def test_delete_menu_item + Redmine::MenuManager.map(:project_menu).push(:foo_menu_item, '/foo', :caption => 'Foo') + + assert_difference 'Redmine::MenuManager.items(:project_menu).size', -1 do + @klass.register :foo do + delete_menu_item :project_menu, :foo_menu_item + end + end + assert_nil Redmine::MenuManager.items(:project_menu).detect {|i| i.name == :foo_menu_item} + end + def test_requires_redmine test = self version = Redmine::VERSION.to_a.slice(0,3).join('.') |