mirror of
https://github.com/redmine/redmine.git
synced 2024-08-27 05:58:46 +02:00
Adds tests for plugin API.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8066 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
7362cd2e10
commit
a0a6571be3
@ -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('.')
|
||||
|
Loading…
Reference in New Issue
Block a user