# Redmine - project management software
-# Copyright (C) 2006-2009 Jean-Philippe Lang
+# Copyright (C) 2006-2011 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
def html_document
HTML::Document.new(@response.body)
end
-
+
def setup
super
@response = ActionController::TestResponse.new
:index
end
end
-
+
context "MenuManager#current_menu_item" do
should "be tested"
assert_select("a.single-node", "Single node")
end
end
-
+
def test_render_menu_node_with_nested_items
parent_node = Redmine::MenuManager::MenuItem.new(:parent_node, '/test', { })
parent_node << Redmine::MenuManager::MenuItem.new(:child_one_node, '/test', { })
end
end
end
-
+
end
def test_render_menu_node_with_children
User.current = User.find(2)
-
+
parent_node = Redmine::MenuManager::MenuItem.new(:parent_node,
'/test',
{
@response.body = render_menu_node(parent_node, Project.find(1))
end
end
-
+
def test_render_menu_node_with_incorrect_children
parent_node = Redmine::MenuManager::MenuItem.new(:parent_node,
'/test',
menu_items_for(menu_name) do |item|
items_yielded << item
end
-
+
assert_equal 3, items_yielded.size
end
end
User.current = User.find(2)
-
+
items = menu_items_for(menu_name, Project.find(1))
assert_equal 2, items.size
end
-
+
def test_menu_items_for_should_skip_items_that_fail_the_conditions
menu_name = :test_menu_items_for_should_skip_items_that_fail_the_conditions
Redmine::MenuManager.map menu_name do |menu|
end
User.current = User.find(2)
-
+
items = menu_items_for(menu_name, Project.find(1))
assert_equal 1, items.size
end