mirror of
https://github.com/redmine/redmine.git
synced 2025-12-16 05:20:28 +01:00
shorten long line of test/unit/lib/redmine/menu_manager/menu_item_test.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@20354 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -54,49 +54,51 @@ class Redmine::MenuManager::MenuItemTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
def test_new_menu_item_should_require_a_proc_to_use_for_the_if_condition
|
def test_new_menu_item_should_require_a_proc_to_use_for_the_if_condition
|
||||||
assert_raises ArgumentError do
|
assert_raises ArgumentError do
|
||||||
Redmine::MenuManager::MenuItem.new(:test_error, '/test',
|
Redmine::MenuManager::MenuItem.new(
|
||||||
{
|
:test_error, '/test', {:if => ['not_a_proc']}
|
||||||
:if => ['not_a_proc']
|
)
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
assert Redmine::MenuManager::MenuItem.new(:test_good_if, '/test',
|
assert(
|
||||||
{
|
Redmine::MenuManager::MenuItem.new(
|
||||||
:if => Proc.new{}
|
:test_good_if, '/test', {:if => Proc.new{}}
|
||||||
})
|
)
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_new_menu_item_should_allow_a_hash_for_extra_html_options
|
def test_new_menu_item_should_allow_a_hash_for_extra_html_options
|
||||||
assert_raises ArgumentError do
|
assert_raises ArgumentError do
|
||||||
Redmine::MenuManager::MenuItem.new(:test_error, '/test',
|
Redmine::MenuManager::MenuItem.new(
|
||||||
{
|
:test_error, '/test',
|
||||||
:html => ['not_a_hash']
|
{:html => ['not_a_hash']}
|
||||||
})
|
)
|
||||||
end
|
end
|
||||||
|
assert(
|
||||||
assert Redmine::MenuManager::MenuItem.new(:test_good_html, '/test',
|
Redmine::MenuManager::MenuItem.new(
|
||||||
{
|
:test_good_html, '/test',
|
||||||
:html => { :onclick => 'doSomething'}
|
{:html => {:onclick => 'doSomething'}}
|
||||||
})
|
)
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_new_menu_item_should_require_a_proc_to_use_the_children_option
|
def test_new_menu_item_should_require_a_proc_to_use_the_children_option
|
||||||
assert_raises ArgumentError do
|
assert_raises ArgumentError do
|
||||||
Redmine::MenuManager::MenuItem.new(:test_error, '/test',
|
Redmine::MenuManager::MenuItem.new(
|
||||||
{
|
:test_error, '/test', {:children => ['not_a_proc']}
|
||||||
:children => ['not_a_proc']
|
)
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
assert(
|
||||||
assert Redmine::MenuManager::MenuItem.new(:test_good_children, '/test',
|
Redmine::MenuManager::MenuItem.new(
|
||||||
{
|
:test_good_children, '/test', {:children => Proc.new{}}
|
||||||
:children => Proc.new{}
|
)
|
||||||
})
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_new_should_not_allow_setting_the_parent_item_to_the_current_item
|
def test_new_should_not_allow_setting_the_parent_item_to_the_current_item
|
||||||
assert_raises ArgumentError do
|
assert_raises ArgumentError do
|
||||||
Redmine::MenuManager::MenuItem.new(:test_error, '/test', { :parent => :test_error })
|
Redmine::MenuManager::MenuItem.new(
|
||||||
|
:test_error, '/test', {:parent => :test_error}
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user