aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/test_case.rb32
-rw-r--r--actionpack/lib/action_controller/test_process.rb1
-rw-r--r--actionpack/test/active_record_unit.rb2
-rw-r--r--actionpack/test/controller/test_test.rb11
4 files changed, 15 insertions, 31 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index 84610c34c0..431876a72e 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -10,7 +10,16 @@ module ActionController
end
class TestCase < ActiveSupport::TestCase
+ module RaiseActionExceptions
+ def rescue_action(e)
+ raise e
+ end
+ end
+
+ setup :setup_controller_request_and_response
+
@@controller_class = nil
+
class << self
def tests(controller_class)
self.controller_class = controller_class
@@ -25,7 +34,7 @@ module ActionController
if current_controller_class = read_inheritable_attribute(:controller_class)
current_controller_class
else
- self.controller_class= determine_default_controller_class(name)
+ self.controller_class = determine_default_controller_class(name)
end
end
@@ -36,31 +45,14 @@ module ActionController
end
def prepare_controller_class(new_class)
- new_class.class_eval do
- def rescue_action(e)
- raise e
- end
- end
+ new_class.send :include, RaiseActionExceptions
end
end
- def setup_with_controller
+ def setup_controller_request_and_response
@controller = self.class.controller_class.new
@request = TestRequest.new
@response = TestResponse.new
end
- alias_method :setup, :setup_with_controller
-
- def self.method_added(method)
- if method.to_s == 'setup'
- unless method_defined?(:setup_without_controller)
- alias_method :setup_without_controller, :setup
- define_method(:setup) do
- setup_with_controller
- setup_without_controller
- end
- end
- end
- end
end
end
diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb
index 4cbb695f4c..ba23f012da 100644
--- a/actionpack/lib/action_controller/test_process.rb
+++ b/actionpack/lib/action_controller/test_process.rb
@@ -1,4 +1,5 @@
require 'action_controller/assertions'
+require 'action_controller/test_case'
module ActionController #:nodoc:
class Base
diff --git a/actionpack/test/active_record_unit.rb b/actionpack/test/active_record_unit.rb
index d4cc474478..a7d526850e 100644
--- a/actionpack/test/active_record_unit.rb
+++ b/actionpack/test/active_record_unit.rb
@@ -84,7 +84,7 @@ class ActiveRecordTestConnector
end
end
-class ActiveRecordTestCase < Test::Unit::TestCase
+class ActiveRecordTestCase < ActiveSupport::TestCase
# Set our fixture path
if ActiveRecordTestConnector.able_to_connect
self.fixture_path = "#{File.dirname(__FILE__)}/fixtures/"
diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb
index 57c97a326c..b3a8e8750b 100644
--- a/actionpack/test/controller/test_test.rb
+++ b/actionpack/test/controller/test_test.rb
@@ -613,18 +613,9 @@ class InferringClassNameTest < Test::Unit::TestCase
end
end
-class ContentControllerTest < ActionController::TestCase
- def setup
- # Should not override ActionController setup methods
- end
-
- def test_should_still_setup_controller
- assert_kind_of(ContentController, @controller)
- end
-end
-
class CrazyNameTest < ActionController::TestCase
tests ContentController
+
def test_controller_class_can_be_set_manually_not_just_inferred
assert_equal ContentController, self.class.controller_class
end