aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-11-07 15:42:34 -0500
committerJeremy Kemper <jeremy@bitsweat.net>2008-11-07 15:42:34 -0500
commitc82e8e1f483ece1fbd2e9f73715fd211487620fc (patch)
tree61711ba9d97ff640c3794f480c14b3cd83264b32
parentebf14baa0eea1d7e98090b189369c1879b05dd54 (diff)
downloadrails-c82e8e1f483ece1fbd2e9f73715fd211487620fc.tar.gz
rails-c82e8e1f483ece1fbd2e9f73715fd211487620fc.tar.bz2
rails-c82e8e1f483ece1fbd2e9f73715fd211487620fc.zip
Move controller assertions from base TestCase to AC:: and AV::TestCase
-rw-r--r--actionpack/lib/action_controller/integration.rb4
-rw-r--r--actionpack/lib/action_controller/test_case.rb57
-rw-r--r--actionpack/lib/action_controller/test_process.rb6
-rw-r--r--actionpack/lib/action_view/test_case.rb4
-rw-r--r--actionpack/test/active_record_unit.rb4
-rw-r--r--actionpack/test/activerecord/render_partial_with_record_identification_test.rb7
-rw-r--r--actionpack/test/controller/action_pack_assertions_test.rb26
-rw-r--r--actionpack/test/controller/assert_select_test.rb131
-rw-r--r--actionpack/test/controller/base_test.rb2
-rw-r--r--actionpack/test/controller/caching_test.rb8
-rw-r--r--actionpack/test/controller/components_test.rb8
-rw-r--r--actionpack/test/controller/deprecation/deprecated_base_methods_test.rb20
-rw-r--r--actionpack/test/controller/html-scanner/sanitizer_test.rb2
-rw-r--r--actionpack/test/controller/layout_test.rb33
-rw-r--r--actionpack/test/controller/mime_responds_test.rb16
-rw-r--r--actionpack/test/controller/polymorphic_routes_test.rb3
-rw-r--r--actionpack/test/controller/redirect_test.rb16
-rw-r--r--actionpack/test/controller/render_test.rb32
-rw-r--r--actionpack/test/controller/request_forgery_protection_test.rb10
-rw-r--r--actionpack/test/controller/request_test.rb26
-rw-r--r--actionpack/test/controller/resources_test.rb2
-rw-r--r--actionpack/test/controller/test_test.rb22
-rw-r--r--actionpack/test/controller/url_rewriter_test.rb5
-rw-r--r--actionpack/test/controller/verification_test.rb2
-rw-r--r--actionpack/test/controller/view_paths_test.rb2
-rw-r--r--actionpack/test/template/atom_feed_helper_test.rb8
26 files changed, 191 insertions, 265 deletions
diff --git a/actionpack/lib/action_controller/integration.rb b/actionpack/lib/action_controller/integration.rb
index fc473c269c..b3771c1ebc 100644
--- a/actionpack/lib/action_controller/integration.rb
+++ b/actionpack/lib/action_controller/integration.rb
@@ -1,4 +1,4 @@
-require 'active_support/test_case'
+require 'action_controller/test_case'
require 'action_controller/dispatcher'
require 'action_controller/test_process'
@@ -16,7 +16,7 @@ module ActionController
# rather than instantiating Integration::Session directly.
class Session
include Test::Unit::Assertions
- include ActionController::Assertions
+ include ActionController::TestCase::Assertions
include ActionController::TestProcess
# The integer HTTP status code of the last request.
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index a0bb3c562c..b925230118 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -1,20 +1,6 @@
require 'active_support/test_case'
module ActionController
- class NonInferrableControllerError < ActionControllerError
- def initialize(name)
- @name = name
- super "Unable to determine the controller to test from #{name}. " +
- "You'll need to specify it using 'tests YourController' in your " +
- "test case definition. This could mean that #{inferred_controller_name} does not exist " +
- "or it contains syntax errors"
- end
-
- def inferred_controller_name
- @name.sub(/Test$/, '')
- end
- end
-
# Superclass for ActionController functional tests. Functional tests allow you to
# test a single controller action per test method. This should not be confused with
# integration tests (see ActionController::IntegrationTest), which are more like
@@ -119,10 +105,21 @@ module ActionController
#
# assert_redirected_to page_url(:title => 'foo')
class TestCase < ActiveSupport::TestCase
- %w(response selector tag dom routing model).each do |kind|
- require "action_controller/assertions/#{kind}_assertions"
- include const_get("#{kind.camelize}Assertions")
+ module Assertions
+ %w(response selector tag dom routing model).each do |kind|
+ require "action_controller/assertions/#{kind}_assertions"
+ include ActionController::Assertions.const_get("#{kind.camelize}Assertions")
+ end
+
+ def clean_backtrace(&block)
+ yield
+ rescue ActiveSupport::TestCase::Assertion => error
+ framework_path = Regexp.new(File.expand_path("#{File.dirname(__FILE__)}/assertions"))
+ error.backtrace.reject! { |line| File.expand_path(line) =~ framework_path }
+ raise
+ end
end
+ include Assertions
# When the request.remote_addr remains the default for testing, which is 0.0.0.0, the exception is simply raised inline
# (bystepping the regular exception handling from rescue_action). If the request.remote_addr is anything else, the regular
@@ -156,7 +153,7 @@ module ActionController
end
def controller_class=(new_class)
- prepare_controller_class(new_class)
+ prepare_controller_class(new_class) if new_class
write_inheritable_attribute(:controller_class, new_class)
end
@@ -171,7 +168,7 @@ module ActionController
def determine_default_controller_class(name)
name.sub(/Test$/, '').constantize
rescue NameError
- raise NonInferrableControllerError.new(name)
+ nil
end
def prepare_controller_class(new_class)
@@ -180,25 +177,23 @@ module ActionController
end
def setup_controller_request_and_response
- @controller = self.class.controller_class.new
- @controller.request = @request = TestRequest.new
+ @request = TestRequest.new
@response = TestResponse.new
- @controller.params = {}
- @controller.send(:initialize_current_url)
+ if klass = self.class.controller_class
+ @controller ||= klass.new rescue nil
+ end
+
+ if @controller
+ @controller.request = @request
+ @controller.params = {}
+ @controller.send(:initialize_current_url)
+ end
end
# Cause the action to be rescued according to the regular rules for rescue_action when the visitor is not local
def rescue_action_in_public!
@request.remote_addr = '208.77.188.166' # example.com
end
-
- def clean_backtrace(&block)
- yield
- rescue Assertion => error
- framework_path = Regexp.new(File.expand_path("#{File.dirname(__FILE__)}/assertions"))
- error.backtrace.reject! { |line| File.expand_path(line) =~ framework_path }
- raise
- end
end
end
diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb
index a5ec23cf50..38e15baac2 100644
--- a/actionpack/lib/action_controller/test_process.rb
+++ b/actionpack/lib/action_controller/test_process.rb
@@ -462,9 +462,9 @@ module ActionController #:nodoc:
html_document.find_all(conditions)
end
- def method_missing(selector, *args)
- if ActionController::Routing::Routes.named_routes.helpers.include?(selector)
- @controller.send(selector, *args)
+ def method_missing(selector, *args, &block)
+ if @controller && ActionController::Routing::Routes.named_routes.helpers.include?(selector)
+ @controller.send(selector, *args, &block)
else
super
end
diff --git a/actionpack/lib/action_view/test_case.rb b/actionpack/lib/action_view/test_case.rb
index c69f9455b2..cdea1def92 100644
--- a/actionpack/lib/action_view/test_case.rb
+++ b/actionpack/lib/action_view/test_case.rb
@@ -1,7 +1,9 @@
-require 'active_support/test_case'
+require 'action_controller/test_case'
module ActionView
class TestCase < ActiveSupport::TestCase
+ include ActionController::TestCase::Assertions
+
class_inheritable_accessor :helper_class
@@helper_class = nil
diff --git a/actionpack/test/active_record_unit.rb b/actionpack/test/active_record_unit.rb
index a377ccad24..8eca6cc9bd 100644
--- a/actionpack/test/active_record_unit.rb
+++ b/actionpack/test/active_record_unit.rb
@@ -82,7 +82,7 @@ class ActiveRecordTestConnector
end
end
-class ActiveRecordTestCase < ActiveSupport::TestCase
+class ActiveRecordTestCase < ActionController::TestCase
# Set our fixture path
if ActiveRecordTestConnector.able_to_connect
self.fixture_path = [FIXTURE_LOAD_PATH]
@@ -96,8 +96,6 @@ class ActiveRecordTestCase < ActiveSupport::TestCase
def run(*args)
super if ActiveRecordTestConnector.connected
end
-
- def default_test; end
end
ActiveRecordTestConnector.setup
diff --git a/actionpack/test/activerecord/render_partial_with_record_identification_test.rb b/actionpack/test/activerecord/render_partial_with_record_identification_test.rb
index d75cb2b53a..822a739112 100644
--- a/actionpack/test/activerecord/render_partial_with_record_identification_test.rb
+++ b/actionpack/test/activerecord/render_partial_with_record_identification_test.rb
@@ -49,13 +49,6 @@ end
class RenderPartialWithRecordIdentificationTest < ActiveRecordTestCase
fixtures :developers, :projects, :developers_projects, :topics, :replies, :companies, :mascots
- def setup
- @controller = RenderPartialWithRecordIdentificationController.new
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- super
- end
-
def test_rendering_partial_with_has_many_and_belongs_to_association
get :render_with_has_many_and_belongs_to_association
assert_template 'projects/_project'
diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb
index 56ba36cee5..7050000dd8 100644
--- a/actionpack/test/controller/action_pack_assertions_test.rb
+++ b/actionpack/test/controller/action_pack_assertions_test.rb
@@ -165,13 +165,11 @@ module Admin
end
# a test case to exercise the new capabilities TestRequest & TestResponse
-class ActionPackAssertionsControllerTest < Test::Unit::TestCase
+class ActionPackAssertionsControllerTest < ActionController::TestCase
# let's get this party started
def setup
ActionController::Routing::Routes.reload
ActionController::Routing.use_controllers!(%w(action_pack_assertions admin/inner_module user content admin/user))
- @controller = ActionPackAssertionsController.new
- @request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new
end
def teardown
@@ -235,13 +233,13 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase
map.connect ':controller/:action/:id'
end
process :redirect_to_named_route
- assert_raise(Test::Unit::AssertionFailedError) do
+ assert_raise(ActiveSupport::TestCase::Assertion) do
assert_redirected_to 'http://test.host/route_two'
end
- assert_raise(Test::Unit::AssertionFailedError) do
+ assert_raise(ActiveSupport::TestCase::Assertion) do
assert_redirected_to :controller => 'action_pack_assertions', :action => 'nothing', :id => 'two'
end
- assert_raise(Test::Unit::AssertionFailedError) do
+ assert_raise(ActiveSupport::TestCase::Assertion) do
assert_redirected_to route_two_url
end
end
@@ -410,7 +408,7 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase
def test_assert_redirection_fails_with_incorrect_controller
process :redirect_to_controller
- assert_raise(Test::Unit::AssertionFailedError) do
+ assert_raise(ActiveSupport::TestCase::Assertion) do
assert_redirected_to :controller => "action_pack_assertions", :action => "flash_me"
end
end
@@ -466,7 +464,7 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase
begin
assert_valid assigns('record')
assert false
- rescue Test::Unit::AssertionFailedError => e
+ rescue ActiveSupport::TestCase::Assertion => e
end
end
@@ -475,7 +473,7 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase
get :index
assert_response :success
flunk 'Expected non-success response'
- rescue Test::Unit::AssertionFailedError => e
+ rescue ActiveSupport::TestCase::Assertion => e
assert e.message.include?('FAIL')
end
@@ -484,17 +482,15 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase
get :show
assert_response :success
flunk 'Expected non-success response'
- rescue Test::Unit::AssertionFailedError
+ rescue ActiveSupport::TestCase::Assertion
+ # success
rescue
flunk "assert_response failed to handle failure response with missing, but optional, exception."
end
end
-class ActionPackHeaderTest < Test::Unit::TestCase
- def setup
- @controller = ActionPackAssertionsController.new
- @request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new
- end
+class ActionPackHeaderTest < ActionController::TestCase
+ tests ActionPackAssertionsController
def test_rendering_xml_sets_content_type
process :hello_xml_world
diff --git a/actionpack/test/controller/assert_select_test.rb b/actionpack/test/controller/assert_select_test.rb
index 08cbcbf302..a79278159d 100644
--- a/actionpack/test/controller/assert_select_test.rb
+++ b/actionpack/test/controller/assert_select_test.rb
@@ -19,7 +19,18 @@ end
ActionMailer::Base.template_root = FIXTURE_LOAD_PATH
-class AssertSelectTest < Test::Unit::TestCase
+class AssertSelectTest < ActionController::TestCase
+ Assertion = ActiveSupport::TestCase::Assertion
+
+ class AssertSelectMailer < ActionMailer::Base
+ def test(html)
+ recipients "test <test@test.host>"
+ from "test@test.host"
+ subject "Test e-mail"
+ part :content_type=>"text/html", :body=>html
+ end
+ end
+
class AssertSelectController < ActionController::Base
def response_with=(content)
@content = content
@@ -51,21 +62,9 @@ class AssertSelectTest < Test::Unit::TestCase
end
end
- class AssertSelectMailer < ActionMailer::Base
- def test(html)
- recipients "test <test@test.host>"
- from "test@test.host"
- subject "Test e-mail"
- part :content_type=>"text/html", :body=>html
- end
- end
-
- AssertionFailedError = Test::Unit::AssertionFailedError
+ tests AssertSelectController
def setup
- @controller = AssertSelectController.new
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
ActionMailer::Base.delivery_method = :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.deliveries = []
@@ -76,7 +75,7 @@ class AssertSelectTest < Test::Unit::TestCase
end
def assert_failure(message, &block)
- e = assert_raises(AssertionFailedError, &block)
+ e = assert_raises(Assertion, &block)
assert_match(message, e.message) if Regexp === message
assert_equal(message, e.message) if String === message
end
@@ -94,43 +93,43 @@ class AssertSelectTest < Test::Unit::TestCase
def test_equality_true_false
render_html %Q{<div id="1"></div><div id="2"></div>}
- assert_nothing_raised { assert_select "div" }
- assert_raises(AssertionFailedError) { assert_select "p" }
- assert_nothing_raised { assert_select "div", true }
- assert_raises(AssertionFailedError) { assert_select "p", true }
- assert_raises(AssertionFailedError) { assert_select "div", false }
- assert_nothing_raised { assert_select "p", false }
+ assert_nothing_raised { assert_select "div" }
+ assert_raises(Assertion) { assert_select "p" }
+ assert_nothing_raised { assert_select "div", true }
+ assert_raises(Assertion) { assert_select "p", true }
+ assert_raises(Assertion) { assert_select "div", false }
+ assert_nothing_raised { assert_select "p", false }
end
def test_equality_string_and_regexp
render_html %Q{<div id="1">foo</div><div id="2">foo</div>}
- assert_nothing_raised { assert_select "div", "foo" }
- assert_raises(AssertionFailedError) { assert_select "div", "bar" }
- assert_nothing_raised { assert_select "div", :text=>"foo" }
- assert_raises(AssertionFailedError) { assert_select "div", :text=>"bar" }
- assert_nothing_raised { assert_select "div", /(foo|bar)/ }
- assert_raises(AssertionFailedError) { assert_select "div", /foobar/ }
- assert_nothing_raised { assert_select "div", :text=>/(foo|bar)/ }
- assert_raises(AssertionFailedError) { assert_select "div", :text=>/foobar/ }
- assert_raises(AssertionFailedError) { assert_select "p", :text=>/foobar/ }
+ assert_nothing_raised { assert_select "div", "foo" }
+ assert_raises(Assertion) { assert_select "div", "bar" }
+ assert_nothing_raised { assert_select "div", :text=>"foo" }
+ assert_raises(Assertion) { assert_select "div", :text=>"bar" }
+ assert_nothing_raised { assert_select "div", /(foo|bar)/ }
+ assert_raises(Assertion) { assert_select "div", /foobar/ }
+ assert_nothing_raised { assert_select "div", :text=>/(foo|bar)/ }
+ assert_raises(Assertion) { assert_select "div", :text=>/foobar/ }
+ assert_raises(Assertion) { assert_select "p", :text=>/foobar/ }
end
def test_equality_of_html
render_html %Q{<p>\n<em>"This is <strong>not</strong> a big problem,"</em> he said.\n</p>}
text = "\"This is not a big problem,\" he said."
html = "<em>\"This is <strong>not</strong> a big problem,\"</em> he said."
- assert_nothing_raised { assert_select "p", text }
- assert_raises(AssertionFailedError) { assert_select "p", html }
- assert_nothing_raised { assert_select "p", :html=>html }
- assert_raises(AssertionFailedError) { assert_select "p", :html=>text }
+ assert_nothing_raised { assert_select "p", text }
+ assert_raises(Assertion) { assert_select "p", html }
+ assert_nothing_raised { assert_select "p", :html=>html }
+ assert_raises(Assertion) { assert_select "p", :html=>text }
# No stripping for pre.
render_html %Q{<pre>\n<em>"This is <strong>not</strong> a big problem,"</em> he said.\n</pre>}
text = "\n\"This is not a big problem,\" he said.\n"
html = "\n<em>\"This is <strong>not</strong> a big problem,\"</em> he said.\n"
- assert_nothing_raised { assert_select "pre", text }
- assert_raises(AssertionFailedError) { assert_select "pre", html }
- assert_nothing_raised { assert_select "pre", :html=>html }
- assert_raises(AssertionFailedError) { assert_select "pre", :html=>text }
+ assert_nothing_raised { assert_select "pre", text }
+ assert_raises(Assertion) { assert_select "pre", html }
+ assert_nothing_raised { assert_select "pre", :html=>html }
+ assert_raises(Assertion) { assert_select "pre", :html=>text }
end
def test_counts
@@ -206,16 +205,16 @@ class AssertSelectTest < Test::Unit::TestCase
def test_assert_select_text_match
render_html %Q{<div id="1"><span>foo</span></div><div id="2"><span>bar</span></div>}
assert_select "div" do
- assert_nothing_raised { assert_select "div", "foo" }
- assert_nothing_raised { assert_select "div", "bar" }
- assert_nothing_raised { assert_select "div", /\w*/ }
- assert_nothing_raised { assert_select "div", /\w*/, :count=>2 }
- assert_raises(AssertionFailedError) { assert_select "div", :text=>"foo", :count=>2 }
- assert_nothing_raised { assert_select "div", :html=>"<span>bar</span>" }
- assert_nothing_raised { assert_select "div", :html=>"<span>bar</span>" }
- assert_nothing_raised { assert_select "div", :html=>/\w*/ }
- assert_nothing_raised { assert_select "div", :html=>/\w*/, :count=>2 }
- assert_raises(AssertionFailedError) { assert_select "div", :html=>"<span>foo</span>", :count=>2 }
+ assert_nothing_raised { assert_select "div", "foo" }
+ assert_nothing_raised { assert_select "div", "bar" }
+ assert_nothing_raised { assert_select "div", /\w*/ }
+ assert_nothing_raised { assert_select "div", /\w*/, :count=>2 }
+ assert_raises(Assertion) { assert_select "div", :text=>"foo", :count=>2 }
+ assert_nothing_raised { assert_select "div", :html=>"<span>bar</span>" }
+ assert_nothing_raised { assert_select "div", :html=>"<span>bar</span>" }
+ assert_nothing_raised { assert_select "div", :html=>/\w*/ }
+ assert_nothing_raised { assert_select "div", :html=>/\w*/, :count=>2 }
+ assert_raises(Assertion) { assert_select "div", :html=>"<span>foo</span>", :count=>2 }
end
end
@@ -323,7 +322,7 @@ class AssertSelectTest < Test::Unit::TestCase
# Test that we fail if there is nothing to pick.
def test_assert_select_rjs_fails_if_nothing_to_pick
render_rjs { }
- assert_raises(AssertionFailedError) { assert_select_rjs }
+ assert_raises(Assertion) { assert_select_rjs }
end
def test_assert_select_rjs_with_unicode
@@ -338,10 +337,10 @@ class AssertSelectTest < Test::Unit::TestCase
if str.respond_to?(:force_encoding)
str.force_encoding(Encoding::UTF_8)
assert_select str, /\343\203\201..\343\203\210/u
- assert_raises(AssertionFailedError) { assert_select str, /\343\203\201.\343\203\210/u }
+ assert_raises(Assertion) { assert_select str, /\343\203\201.\343\203\210/u }
else
assert_select str, Regexp.new("\343\203\201..\343\203\210",0,'U')
- assert_raises(AssertionFailedError) { assert_select str, Regexp.new("\343\203\201.\343\203\210",0,'U') }
+ assert_raises(Assertion) { assert_select str, Regexp.new("\343\203\201.\343\203\210",0,'U') }
end
end
end
@@ -365,7 +364,7 @@ class AssertSelectTest < Test::Unit::TestCase
assert_select "div", 1
assert_select "#3"
end
- assert_raises(AssertionFailedError) { assert_select_rjs "test4" }
+ assert_raises(Assertion) { assert_select_rjs "test4" }
end
def test_assert_select_rjs_for_replace
@@ -383,7 +382,7 @@ class AssertSelectTest < Test::Unit::TestCase
assert_select "div", 1
assert_select "#1"
end
- assert_raises(AssertionFailedError) { assert_select_rjs :replace, "test2" }
+ assert_raises(Assertion) { assert_select_rjs :replace, "test2" }
# Replace HTML.
assert_select_rjs :replace_html do
assert_select "div", 1
@@ -393,7 +392,7 @@ class AssertSelectTest < Test::Unit::TestCase
assert_select "div", 1
assert_select "#2"
end
- assert_raises(AssertionFailedError) { assert_select_rjs :replace_html, "test1" }
+ assert_raises(Assertion) { assert_select_rjs :replace_html, "test1" }
end
def test_assert_select_rjs_for_chained_replace
@@ -411,7 +410,7 @@ class AssertSelectTest < Test::Unit::TestCase
assert_select "div", 1
assert_select "#1"
end
- assert_raises(AssertionFailedError) { assert_select_rjs :chained_replace, "test2" }
+ assert_raises(Assertion) { assert_select_rjs :chained_replace, "test2" }
# Replace HTML.
assert_select_rjs :chained_replace_html do
assert_select "div", 1
@@ -421,7 +420,7 @@ class AssertSelectTest < Test::Unit::TestCase
assert_select "div", 1
assert_select "#2"
end
- assert_raises(AssertionFailedError) { assert_select_rjs :replace_html, "test1" }
+ assert_raises(Assertion) { assert_select_rjs :replace_html, "test1" }
end
# Simple remove
@@ -440,8 +439,8 @@ class AssertSelectTest < Test::Unit::TestCase
assert_select_rjs :remove, "test1"
- rescue Test::Unit::AssertionFailedError
- assert_equal "No RJS statement that removes 'test1' was rendered.", $!.message
+ rescue Assertion
+ assert_equal "No RJS statement that removes 'test1' was rendered.", $!.message
end
def test_assert_select_rjs_for_remove_ignores_block
@@ -472,8 +471,8 @@ class AssertSelectTest < Test::Unit::TestCase
assert_select_rjs :show, "test1"
- rescue Test::Unit::AssertionFailedError
- assert_equal "No RJS statement that shows 'test1' was rendered.", $!.message
+ rescue Assertion
+ assert_equal "No RJS statement that shows 'test1' was rendered.", $!.message
end
def test_assert_select_rjs_for_show_ignores_block
@@ -504,8 +503,8 @@ class AssertSelectTest < Test::Unit::TestCase
assert_select_rjs :hide, "test1"
- rescue Test::Unit::AssertionFailedError
- assert_equal "No RJS statement that hides 'test1' was rendered.", $!.message
+ rescue Assertion
+ assert_equal "No RJS statement that hides 'test1' was rendered.", $!.message
end
def test_assert_select_rjs_for_hide_ignores_block
@@ -536,8 +535,8 @@ class AssertSelectTest < Test::Unit::TestCase
assert_select_rjs :toggle, "test1"
- rescue Test::Unit::AssertionFailedError
- assert_equal "No RJS statement that toggles 'test1' was rendered.", $!.message
+ rescue Assertion
+ assert_equal "No RJS statement that toggles 'test1' was rendered.", $!.message
end
def test_assert_select_rjs_for_toggle_ignores_block
@@ -567,7 +566,7 @@ class AssertSelectTest < Test::Unit::TestCase
assert_select "div", 1
assert_select "#3"
end
- assert_raises(AssertionFailedError) { assert_select_rjs :insert_html, "test1" }
+ assert_raises(Assertion) { assert_select_rjs :insert_html, "test1" }
end
# Positioned insert.
@@ -693,7 +692,7 @@ EOF
#
def test_assert_select_email
- assert_raises(AssertionFailedError) { assert_select_email {} }
+ assert_raises(Assertion) { assert_select_email {} }
AssertSelectMailer.deliver_test "<div><p>foo</p><p>bar</p></div>"
assert_select_email do
assert_select "div:root" do
diff --git a/actionpack/test/controller/base_test.rb b/actionpack/test/controller/base_test.rb
index 738c016c6e..18d185b264 100644
--- a/actionpack/test/controller/base_test.rb
+++ b/actionpack/test/controller/base_test.rb
@@ -105,7 +105,7 @@ class ControllerInstanceTests < Test::Unit::TestCase
end
-class PerformActionTest < Test::Unit::TestCase
+class PerformActionTest < ActionController::TestCase
class MockLogger
attr_reader :logged
diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb
index b6cdd116e5..ad160970cc 100644
--- a/actionpack/test/controller/caching_test.rb
+++ b/actionpack/test/controller/caching_test.rb
@@ -42,7 +42,7 @@ class PageCachingTestController < ActionController::Base
end
end
-class PageCachingTest < Test::Unit::TestCase
+class PageCachingTest < ActionController::TestCase
def setup
ActionController::Base.perform_caching = true
@@ -222,7 +222,7 @@ class ActionCachingMockController
end
end
-class ActionCacheTest < Test::Unit::TestCase
+class ActionCacheTest < ActionController::TestCase
def setup
reset!
FileUtils.mkdir_p(FILE_STORE_PATH)
@@ -469,7 +469,7 @@ class FragmentCachingTestController < ActionController::Base
def some_action; end;
end
-class FragmentCachingTest < Test::Unit::TestCase
+class FragmentCachingTest < ActionController::TestCase
def setup
ActionController::Base.perform_caching = true
@store = ActiveSupport::Cache::MemoryStore.new
@@ -601,7 +601,7 @@ class FunctionalCachingController < ActionController::Base
end
end
-class FunctionalFragmentCachingTest < Test::Unit::TestCase
+class FunctionalFragmentCachingTest < ActionController::TestCase
def setup
ActionController::Base.perform_caching = true
@store = ActiveSupport::Cache::MemoryStore.new
diff --git a/actionpack/test/controller/components_test.rb b/actionpack/test/controller/components_test.rb
index 4d36fc411d..e7b17aa34e 100644
--- a/actionpack/test/controller/components_test.rb
+++ b/actionpack/test/controller/components_test.rb
@@ -69,12 +69,8 @@ class CalleeController < ActionController::Base
def rescue_action(e) raise end
end
-class ComponentsTest < Test::Unit::TestCase
- def setup
- @controller = CallerController.new
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- end
+class ComponentsTest < ActionController::TestCase
+ tests CallerController
def test_calling_from_controller
assert_deprecated do
diff --git a/actionpack/test/controller/deprecation/deprecated_base_methods_test.rb b/actionpack/test/controller/deprecation/deprecated_base_methods_test.rb
index 86555a77df..dd69a63020 100644
--- a/actionpack/test/controller/deprecation/deprecated_base_methods_test.rb
+++ b/actionpack/test/controller/deprecation/deprecated_base_methods_test.rb
@@ -1,6 +1,6 @@
require 'abstract_unit'
-class DeprecatedBaseMethodsTest < Test::Unit::TestCase
+class DeprecatedBaseMethodsTest < ActionController::TestCase
class Target < ActionController::Base
def home_url(greeting)
"http://example.com/#{greeting}"
@@ -13,11 +13,7 @@ class DeprecatedBaseMethodsTest < Test::Unit::TestCase
def rescue_action(e) raise e end
end
- def setup
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- @controller = Target.new
- end
+ tests Target
def test_log_error_silences_deprecation_warnings
get :raises_name_error
@@ -25,10 +21,12 @@ class DeprecatedBaseMethodsTest < Test::Unit::TestCase
assert_not_deprecated { @controller.send :log_error, e }
end
- def test_assertion_failed_error_silences_deprecation_warnings
- get :raises_name_error
- rescue => e
- error = Test::Unit::Error.new('testing ur doodz', e)
- assert_not_deprecated { error.message }
+ if defined? Test::Unit::Error
+ def test_assertion_failed_error_silences_deprecation_warnings
+ get :raises_name_error
+ rescue => e
+ error = Test::Unit::Error.new('testing ur doodz', e)
+ assert_not_deprecated { error.message }
+ end
end
end
diff --git a/actionpack/test/controller/html-scanner/sanitizer_test.rb b/actionpack/test/controller/html-scanner/sanitizer_test.rb
index bae0f5c9fd..e85a5c7abf 100644
--- a/actionpack/test/controller/html-scanner/sanitizer_test.rb
+++ b/actionpack/test/controller/html-scanner/sanitizer_test.rb
@@ -1,6 +1,6 @@
require 'abstract_unit'
-class SanitizerTest < Test::Unit::TestCase
+class SanitizerTest < ActionController::TestCase
def setup
@sanitizer = nil # used by assert_sanitizer
end
diff --git a/actionpack/test/controller/layout_test.rb b/actionpack/test/controller/layout_test.rb
index 1120fdbff5..61c20f8299 100644
--- a/actionpack/test/controller/layout_test.rb
+++ b/actionpack/test/controller/layout_test.rb
@@ -34,11 +34,8 @@ end
ActionView::Template::register_template_handler :mab,
lambda { |template| template.source.inspect }
-class LayoutAutoDiscoveryTest < Test::Unit::TestCase
+class LayoutAutoDiscoveryTest < ActionController::TestCase
def setup
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
-
@request.host = "www.nextangle.com"
end
@@ -98,12 +95,7 @@ class RendersNoLayoutController < LayoutTest
end
end
-class LayoutSetInResponseTest < Test::Unit::TestCase
- def setup
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- end
-
+class LayoutSetInResponseTest < ActionController::TestCase
def test_layout_set_when_using_default_layout
@controller = DefaultLayoutController.new
get :hello
@@ -150,12 +142,7 @@ class SetsNonExistentLayoutFile < LayoutTest
layout "nofile.rhtml"
end
-class LayoutExceptionRaised < Test::Unit::TestCase
- def setup
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- end
-
+class LayoutExceptionRaised < ActionController::TestCase
def test_exception_raised_when_layout_file_not_found
@controller = SetsNonExistentLayoutFile.new
get :hello
@@ -170,12 +157,7 @@ class LayoutStatusIsRendered < LayoutTest
end
end
-class LayoutStatusIsRenderedTest < Test::Unit::TestCase
- def setup
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- end
-
+class LayoutStatusIsRenderedTest < ActionController::TestCase
def test_layout_status_is_rendered
@controller = LayoutStatusIsRendered.new
get :hello
@@ -187,12 +169,7 @@ class LayoutSymlinkedTest < LayoutTest
layout "symlinked/symlinked_layout"
end
-class LayoutSymlinkedIsRenderedTest < Test::Unit::TestCase
- def setup
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- end
-
+class LayoutSymlinkedIsRenderedTest < ActionController::TestCase
def test_symlinked_layout_is_rendered
@controller = LayoutSymlinkedTest.new
get :hello
diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb
index 0d508eb8df..dc59180a68 100644
--- a/actionpack/test/controller/mime_responds_test.rb
+++ b/actionpack/test/controller/mime_responds_test.rb
@@ -162,13 +162,11 @@ class RespondToController < ActionController::Base
end
end
-class MimeControllerTest < Test::Unit::TestCase
+class MimeControllerTest < ActionController::TestCase
+ tests RespondToController
+
def setup
ActionController::Base.use_accept_header = true
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
-
- @controller = RespondToController.new
@request.host = "www.example.com"
end
@@ -509,12 +507,10 @@ class SuperPostController < PostController
end
end
-class MimeControllerLayoutsTest < Test::Unit::TestCase
- def setup
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
+class MimeControllerLayoutsTest < ActionController::TestCase
+ tests PostController
- @controller = PostController.new
+ def setup
@request.host = "www.example.com"
end
diff --git a/actionpack/test/controller/polymorphic_routes_test.rb b/actionpack/test/controller/polymorphic_routes_test.rb
index 6ddf2826cd..df49a37f89 100644
--- a/actionpack/test/controller/polymorphic_routes_test.rb
+++ b/actionpack/test/controller/polymorphic_routes_test.rb
@@ -22,8 +22,7 @@ end
class Response::Nested < Response; end
uses_mocha 'polymorphic URL helpers' do
- class PolymorphicRoutesTest < Test::Unit::TestCase
-
+ class PolymorphicRoutesTest < ActiveSupport::TestCase
include ActionController::PolymorphicRoutes
def setup
diff --git a/actionpack/test/controller/redirect_test.rb b/actionpack/test/controller/redirect_test.rb
index c55307d645..27cedc91d2 100644
--- a/actionpack/test/controller/redirect_test.rb
+++ b/actionpack/test/controller/redirect_test.rb
@@ -103,12 +103,8 @@ class RedirectController < ActionController::Base
end
end
-class RedirectTest < Test::Unit::TestCase
- def setup
- @controller = RedirectController.new
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- end
+class RedirectTest < ActionController::TestCase
+ tests RedirectController
def test_simple_redirect
get :simple_redirect
@@ -256,12 +252,8 @@ module ModuleTest
end
end
- class ModuleRedirectTest < Test::Unit::TestCase
- def setup
- @controller = ModuleRedirectController.new
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- end
+ class ModuleRedirectTest < ActionController::TestCase
+ tests ModuleRedirectController
def test_simple_redirect
get :simple_redirect
diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb
index df9376727f..6a03466db1 100644
--- a/actionpack/test/controller/render_test.rb
+++ b/actionpack/test/controller/render_test.rb
@@ -641,12 +641,10 @@ class TestController < ActionController::Base
end
end
-class RenderTest < Test::Unit::TestCase
- def setup
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- @controller = TestController.new
+class RenderTest < ActionController::TestCase
+ tests TestController
+ def setup
# enable a logger so that (e.g.) the benchmarking stuff runs, so we can get
# a more accurate simulation of what happens in "real life".
@controller.logger = Logger.new(nil)
@@ -1333,12 +1331,10 @@ class RenderTest < Test::Unit::TestCase
end
end
-class EtagRenderTest < Test::Unit::TestCase
- def setup
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- @controller = TestController.new
+class EtagRenderTest < ActionController::TestCase
+ tests TestController
+ def setup
@request.host = "www.nextangle.com"
@expected_bang_etag = etag_for(expand_key([:foo, 123]))
end
@@ -1430,12 +1426,10 @@ class EtagRenderTest < Test::Unit::TestCase
end
end
-class LastModifiedRenderTest < Test::Unit::TestCase
- def setup
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- @controller = TestController.new
+class LastModifiedRenderTest < ActionController::TestCase
+ tests TestController
+ def setup
@request.host = "www.nextangle.com"
@last_modified = Time.now.utc.beginning_of_day.httpdate
end
@@ -1487,12 +1481,10 @@ class LastModifiedRenderTest < Test::Unit::TestCase
end
end
-class RenderingLoggingTest < Test::Unit::TestCase
- def setup
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- @controller = TestController.new
+class RenderingLoggingTest < ActionController::TestCase
+ tests TestController
+ def setup
@request.host = "www.nextangle.com"
end
diff --git a/actionpack/test/controller/request_forgery_protection_test.rb b/actionpack/test/controller/request_forgery_protection_test.rb
index f7adaa7d4e..9dbfd120f2 100644
--- a/actionpack/test/controller/request_forgery_protection_test.rb
+++ b/actionpack/test/controller/request_forgery_protection_test.rb
@@ -222,7 +222,7 @@ end
# OK let's get our test on
-class RequestForgeryProtectionControllerTest < Test::Unit::TestCase
+class RequestForgeryProtectionControllerTest < ActionController::TestCase
include RequestForgeryProtectionTests
def setup
@controller = RequestForgeryProtectionController.new
@@ -236,7 +236,7 @@ class RequestForgeryProtectionControllerTest < Test::Unit::TestCase
end
end
-class RequestForgeryProtectionWithoutSecretControllerTest < Test::Unit::TestCase
+class RequestForgeryProtectionWithoutSecretControllerTest < ActionController::TestCase
def setup
@controller = RequestForgeryProtectionWithoutSecretController.new
@request = ActionController::TestRequest.new
@@ -255,7 +255,7 @@ class RequestForgeryProtectionWithoutSecretControllerTest < Test::Unit::TestCase
end
end
-class CsrfCookieMonsterControllerTest < Test::Unit::TestCase
+class CsrfCookieMonsterControllerTest < ActionController::TestCase
include RequestForgeryProtectionTests
def setup
@controller = CsrfCookieMonsterController.new
@@ -271,7 +271,7 @@ class CsrfCookieMonsterControllerTest < Test::Unit::TestCase
end
end
-class FreeCookieControllerTest < Test::Unit::TestCase
+class FreeCookieControllerTest < ActionController::TestCase
def setup
@controller = FreeCookieController.new
@request = ActionController::TestRequest.new
@@ -296,7 +296,7 @@ class FreeCookieControllerTest < Test::Unit::TestCase
end
end
-class SessionOffControllerTest < Test::Unit::TestCase
+class SessionOffControllerTest < ActionController::TestCase
def setup
@controller = SessionOffController.new
@request = ActionController::TestRequest.new
diff --git a/actionpack/test/controller/request_test.rb b/actionpack/test/controller/request_test.rb
index e79a0ea76b..2dc2ed9965 100644
--- a/actionpack/test/controller/request_test.rb
+++ b/actionpack/test/controller/request_test.rb
@@ -1,7 +1,7 @@
require 'abstract_unit'
require 'action_controller/integration'
-class RequestTest < Test::Unit::TestCase
+class RequestTest < ActiveSupport::TestCase
def setup
ActionController::Base.relative_url_root = nil
@request = ActionController::TestRequest.new
@@ -400,7 +400,7 @@ class RequestTest < Test::Unit::TestCase
end
end
-class UrlEncodedRequestParameterParsingTest < Test::Unit::TestCase
+class UrlEncodedRequestParameterParsingTest < ActiveSupport::TestCase
def setup
@query_string = "action=create_customer&full_name=David%20Heinemeier%20Hansson&customerId=1"
@query_string_with_empty = "action=create_customer&full_name="
@@ -704,20 +704,20 @@ class UrlEncodedRequestParameterParsingTest < Test::Unit::TestCase
end
end
-class MultipartRequestParameterParsingTest < Test::Unit::TestCase
+class MultipartRequestParameterParsingTest < ActiveSupport::TestCase
FIXTURE_PATH = File.dirname(__FILE__) + '/../fixtures/multipart'
def test_single_parameter
- params = process('single_parameter')
+ params = parse_multipart('single_parameter')
assert_equal({ 'foo' => 'bar' }, params)
end
def test_bracketed_param
- assert_equal({ 'foo' => { 'baz' => 'bar'}}, process('bracketed_param'))
+ assert_equal({ 'foo' => { 'baz' => 'bar'}}, parse_multipart('bracketed_param'))
end
def test_text_file
- params = process('text_file')
+ params = parse_multipart('text_file')
assert_equal %w(file foo), params.keys.sort
assert_equal 'bar', params['foo']
@@ -729,7 +729,7 @@ class MultipartRequestParameterParsingTest < Test::Unit::TestCase
end
def test_boundary_problem_file
- params = process('boundary_problem_file')
+ params = parse_multipart('boundary_problem_file')
assert_equal %w(file foo), params.keys.sort
file = params['file']
@@ -748,7 +748,7 @@ class MultipartRequestParameterParsingTest < Test::Unit::TestCase
end
def test_large_text_file
- params = process('large_text_file')
+ params = parse_multipart('large_text_file')
assert_equal %w(file foo), params.keys.sort
assert_equal 'bar', params['foo']
@@ -774,7 +774,7 @@ class MultipartRequestParameterParsingTest < Test::Unit::TestCase
end
def test_binary_file
- params = process('binary_file')
+ params = parse_multipart('binary_file')
assert_equal %w(file flowers foo), params.keys.sort
assert_equal 'bar', params['foo']
@@ -793,7 +793,7 @@ class MultipartRequestParameterParsingTest < Test::Unit::TestCase
end
def test_mixed_files
- params = process('mixed_files')
+ params = parse_multipart('mixed_files')
assert_equal %w(files foo), params.keys.sort
assert_equal 'bar', params['foo']
@@ -805,7 +805,7 @@ class MultipartRequestParameterParsingTest < Test::Unit::TestCase
end
private
- def process(name)
+ def parse_multipart(name)
File.open(File.join(FIXTURE_PATH, name), 'rb') do |file|
params = ActionController::AbstractRequest.parse_multipart_form_parameters(file, 'AaB03x', file.stat.size, {})
assert_equal 0, file.pos # file was rewound after reading
@@ -814,7 +814,7 @@ class MultipartRequestParameterParsingTest < Test::Unit::TestCase
end
end
-class XmlParamsParsingTest < Test::Unit::TestCase
+class XmlParamsParsingTest < ActiveSupport::TestCase
def test_hash_params
person = parse_body("<person><name>David</name></person>")[:person]
assert_kind_of Hash, person
@@ -868,7 +868,7 @@ class LegacyXmlParamsParsingTest < XmlParamsParsingTest
end
end
-class JsonParamsParsingTest < Test::Unit::TestCase
+class JsonParamsParsingTest < ActiveSupport::TestCase
def test_hash_params_for_application_json
person = parse_body({:person => {:name => "David"}}.to_json,'application/json')[:person]
assert_kind_of Hash, person
diff --git a/actionpack/test/controller/resources_test.rb b/actionpack/test/controller/resources_test.rb
index 1fea82e564..3e656fa51b 100644
--- a/actionpack/test/controller/resources_test.rb
+++ b/actionpack/test/controller/resources_test.rb
@@ -27,7 +27,7 @@ module Backoffice
end
end
-class ResourcesTest < Test::Unit::TestCase
+class ResourcesTest < ActionController::TestCase
# The assertions in these tests are incompatible with the hash method
# optimisation. This could indicate user level problems
def setup
diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb
index a23428804a..02eb447f31 100644
--- a/actionpack/test/controller/test_test.rb
+++ b/actionpack/test/controller/test_test.rb
@@ -1,7 +1,7 @@
require 'abstract_unit'
require 'controller/fake_controllers'
-class TestTest < Test::Unit::TestCase
+class TestTest < ActionController::TestCase
class TestController < ActionController::Base
def no_op
render :text => 'dummy'
@@ -24,7 +24,7 @@ class TestTest < Test::Unit::TestCase
end
def render_raw_post
- raise Test::Unit::AssertionFailedError, "#raw_post is blank" if request.raw_post.blank?
+ raise ActiveSupport::TestCase::Assertion, "#raw_post is blank" if request.raw_post.blank?
render :text => request.raw_post
end
@@ -580,7 +580,7 @@ XML
assert_equal @response.redirect_url, redirect_to_url
# Must be a :redirect response.
- assert_raise(Test::Unit::AssertionFailedError) do
+ assert_raise(ActiveSupport::TestCase::Assertion) do
assert_redirected_to 'created resource'
end
end
@@ -602,9 +602,9 @@ XML
end
end
-class CleanBacktraceTest < Test::Unit::TestCase
+class CleanBacktraceTest < ActionController::TestCase
def test_should_reraise_the_same_object
- exception = Test::Unit::AssertionFailedError.new('message')
+ exception = ActiveSupport::TestCase::Assertion.new('message')
clean_backtrace { raise exception }
rescue => caught
assert_equal exception.object_id, caught.object_id
@@ -613,7 +613,7 @@ class CleanBacktraceTest < Test::Unit::TestCase
def test_should_clean_assertion_lines_from_backtrace
path = File.expand_path("#{File.dirname(__FILE__)}/../../lib/action_controller")
- exception = Test::Unit::AssertionFailedError.new('message')
+ exception = ActiveSupport::TestCase::Assertion.new('message')
exception.set_backtrace ["#{path}/abc", "#{path}/assertions/def"]
clean_backtrace { raise exception }
rescue => caught
@@ -629,21 +629,17 @@ class CleanBacktraceTest < Test::Unit::TestCase
end
end
-class InferringClassNameTest < Test::Unit::TestCase
+class InferringClassNameTest < ActionController::TestCase
def test_determine_controller_class
assert_equal ContentController, determine_class("ContentControllerTest")
end
def test_determine_controller_class_with_nonsense_name
- assert_raises ActionController::NonInferrableControllerError do
- determine_class("HelloGoodBye")
- end
+ assert_nil determine_class("HelloGoodBye")
end
def test_determine_controller_class_with_sensible_name_where_no_controller_exists
- assert_raises ActionController::NonInferrableControllerError do
- determine_class("NoControllerWithThisNameTest")
- end
+ assert_nil determine_class("NoControllerWithThisNameTest")
end
private
diff --git a/actionpack/test/controller/url_rewriter_test.rb b/actionpack/test/controller/url_rewriter_test.rb
index 64e9a085ca..8bc343e2ea 100644
--- a/actionpack/test/controller/url_rewriter_test.rb
+++ b/actionpack/test/controller/url_rewriter_test.rb
@@ -2,7 +2,7 @@ require 'abstract_unit'
ActionController::UrlRewriter
-class UrlRewriterTests < Test::Unit::TestCase
+class UrlRewriterTests < ActionController::TestCase
def setup
@request = ActionController::TestRequest.new
@params = {}
@@ -85,8 +85,7 @@ class UrlRewriterTests < Test::Unit::TestCase
end
end
-class UrlWriterTests < Test::Unit::TestCase
-
+class UrlWriterTests < ActionController::TestCase
class W
include ActionController::UrlWriter
end
diff --git a/actionpack/test/controller/verification_test.rb b/actionpack/test/controller/verification_test.rb
index b289443129..418a81baa8 100644
--- a/actionpack/test/controller/verification_test.rb
+++ b/actionpack/test/controller/verification_test.rb
@@ -1,6 +1,6 @@
require 'abstract_unit'
-class VerificationTest < Test::Unit::TestCase
+class VerificationTest < ActionController::TestCase
class TestController < ActionController::Base
verify :only => :guarded_one, :params => "one",
:add_flash => { :error => 'unguarded' },
diff --git a/actionpack/test/controller/view_paths_test.rb b/actionpack/test/controller/view_paths_test.rb
index b859a92cbd..04e14d8eac 100644
--- a/actionpack/test/controller/view_paths_test.rb
+++ b/actionpack/test/controller/view_paths_test.rb
@@ -1,6 +1,6 @@
require 'abstract_unit'
-class ViewLoadPathsTest < Test::Unit::TestCase
+class ViewLoadPathsTest < ActionController::TestCase
class TestController < ActionController::Base
def self.controller_path() "test" end
def rescue_action(e) raise end
diff --git a/actionpack/test/template/atom_feed_helper_test.rb b/actionpack/test/template/atom_feed_helper_test.rb
index 9247a42d33..317a5cf28c 100644
--- a/actionpack/test/template/atom_feed_helper_test.rb
+++ b/actionpack/test/template/atom_feed_helper_test.rb
@@ -166,12 +166,10 @@ class ScrollsController < ActionController::Base
end
end
-class AtomFeedTest < Test::Unit::TestCase
- def setup
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- @controller = ScrollsController.new
+class AtomFeedTest < ActionController::TestCase
+ tests ScrollsController
+ def setup
@request.host = "www.nextangle.com"
end