summaryrefslogtreecommitdiffstats
path: root/test
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
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')
-rw-r--r--test/helper_testcase.rb35
-rw-r--r--test/test_helper.rb1
-rw-r--r--test/unit/lib/redmine/menu_manager/menu_helper_test.rb29
3 files changed, 11 insertions, 54 deletions
diff --git a/test/helper_testcase.rb b/test/helper_testcase.rb
deleted file mode 100644
index dc29e2c86..000000000
--- a/test/helper_testcase.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-# Re-raise errors caught by the controller.
-class StubController < ApplicationController
- def rescue_action(e) raise e end;
- attr_accessor :request, :url
-end
-
-class HelperTestCase < ActiveSupport::TestCase
-
- # Add other helpers here if you need them
- include ActionView::Helpers::ActiveRecordHelper
- include ActionView::Helpers::TagHelper
- include ActionView::Helpers::FormTagHelper
- include ActionView::Helpers::FormOptionsHelper
- include ActionView::Helpers::FormHelper
- include ActionView::Helpers::UrlHelper
- include ActionView::Helpers::AssetTagHelper
- include ActionView::Helpers::PrototypeHelper
-
- def setup
- super
-
- @request = ActionController::TestRequest.new
- @controller = StubController.new
- @controller.request = @request
-
- # Fake url rewriter so we can test url_for
- @controller.url = ActionController::UrlRewriter.new @request, {}
-
- ActionView::Helpers::AssetTagHelper::reset_javascript_include_default
- end
-
- def test_dummy
- # do nothing - required by test/unit
- end
-end
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 09d9c3bb0..2fa726ad5 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -18,7 +18,6 @@
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
-require File.expand_path(File.dirname(__FILE__) + '/helper_testcase')
require Rails.root.join('test', 'mocks', 'open_id_authentication_mock.rb').to_s
require File.expand_path(File.dirname(__FILE__) + '/object_daddy_helpers')
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