summaryrefslogtreecommitdiffstats
path: root/test/unit/lib
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-12-18 09:40:19 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-12-18 09:40:19 +0000
commitaadf6da468cc084a90b1492f02e59704ca8d9948 (patch)
treec7f7e89747c9104708f1f88362bac225ecf2bc90 /test/unit/lib
parenteed1a5dfbd91d327aa4511bbebe4f549d3188478 (diff)
downloadredmine-aadf6da468cc084a90b1492f02e59704ca8d9948.tar.gz
redmine-aadf6da468cc084a90b1492f02e59704ca8d9948.zip
Get rid of HelperTestcase.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8278 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/lib')
-rw-r--r--test/unit/lib/redmine/menu_manager/menu_helper_test.rb29
1 files changed, 11 insertions, 18 deletions
diff --git a/test/unit/lib/redmine/menu_manager/menu_helper_test.rb b/test/unit/lib/redmine/menu_manager/menu_helper_test.rb
index 48f0b6505..2eb6fc73c 100644
--- a/test/unit/lib/redmine/menu_manager/menu_helper_test.rb
+++ b/test/unit/lib/redmine/menu_manager/menu_helper_test.rb
@@ -17,26 +17,20 @@
require File.expand_path('../../../../../test_helper', __FILE__)
-class Redmine::MenuManager::MenuHelperTest < HelperTestCase
+class Redmine::MenuManager::MenuHelperTest < ActionView::TestCase
+
include Redmine::MenuManager::MenuHelper
- include ActionController::Assertions::SelectorAssertions
+ include ERB::Util
fixtures :users, :members, :projects, :enabled_modules
- # Used by assert_select
- def html_document
- HTML::Document.new(@response.body)
- end
-
def setup
- super
- @response = ActionController::TestResponse.new
+ setup_with_controller
# Stub the current menu item in the controller
def current_menu_item
:index
end
end
-
context "MenuManager#current_menu_item" do
should "be tested"
end
@@ -59,14 +53,14 @@ class Redmine::MenuManager::MenuHelperTest < HelperTestCase
def test_render_single_menu_node
node = Redmine::MenuManager::MenuItem.new(:testing, '/test', { })
- @response.body = render_single_menu_node(node, 'This is a test', node.url, false)
+ @output_buffer = render_single_menu_node(node, 'This is a test', node.url, false)
assert_select("a.testing", "This is a test")
end
def test_render_menu_node
single_node = Redmine::MenuManager::MenuItem.new(:single_node, '/test', { })
- @response.body = render_menu_node(single_node, nil)
+ @output_buffer = render_menu_node(single_node, nil)
assert_select("li") do
assert_select("a.single-node", "Single node")
@@ -81,7 +75,7 @@ class Redmine::MenuManager::MenuHelperTest < HelperTestCase
Redmine::MenuManager::MenuItem.new(:child_three_node, '/test', { }) <<
Redmine::MenuManager::MenuItem.new(:child_three_inner_node, '/test', { })
- @response.body = render_menu_node(parent_node, nil)
+ @output_buffer = render_menu_node(parent_node, nil)
assert_select("li") do
assert_select("a.parent-node", "Parent node")
@@ -115,7 +109,7 @@ class Redmine::MenuManager::MenuHelperTest < HelperTestCase
children
}
})
- @response.body = render_menu_node(parent_node, Project.find(1))
+ @output_buffer = render_menu_node(parent_node, Project.find(1))
assert_select("li") do
assert_select("a.parent-node", "Parent node")
@@ -154,7 +148,7 @@ class Redmine::MenuManager::MenuHelperTest < HelperTestCase
}
})
- @response.body = render_menu_node(parent_node, Project.find(1))
+ @output_buffer = render_menu_node(parent_node, Project.find(1))
assert_select("li") do
assert_select("a.parent-node", "Parent node")
@@ -183,7 +177,7 @@ class Redmine::MenuManager::MenuHelperTest < HelperTestCase
})
assert_raises Redmine::MenuManager::MenuError, ":children must be an array of MenuItems" do
- @response.body = render_menu_node(parent_node, Project.find(1))
+ @output_buffer = render_menu_node(parent_node, Project.find(1))
end
end
@@ -195,7 +189,7 @@ class Redmine::MenuManager::MenuHelperTest < HelperTestCase
})
assert_raises Redmine::MenuManager::MenuError, ":children must be an array of MenuItems" do
- @response.body = render_menu_node(parent_node, Project.find(1))
+ @output_buffer = render_menu_node(parent_node, Project.find(1))
end
end
@@ -256,5 +250,4 @@ class Redmine::MenuManager::MenuHelperTest < HelperTestCase
items = menu_items_for(menu_name, Project.find(1))
assert_equal 1, items.size
end
-
end