Get rid of HelperTestcase.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8278 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
eed1a5dfbd
commit
aadf6da468
|
@ -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
|
|
@ -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')
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue