From 26eaf073c4de8276663f927fdeeb91453e8b3956 Mon Sep 17 00:00:00 2001 From: Nicholas Seckar Date: Sun, 26 Feb 2006 17:49:09 +0000 Subject: Remove ::Controllers related cruft; fix AP tests git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3668 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/controller/base_test.rb | 73 ++++++++++++---------------- actionpack/test/controller/benchmark_test.rb | 19 +++----- 2 files changed, 39 insertions(+), 53 deletions(-) (limited to 'actionpack/test/controller') diff --git a/actionpack/test/controller/base_test.rb b/actionpack/test/controller/base_test.rb index 9687aa2748..10a3e0ce35 100644 --- a/actionpack/test/controller/base_test.rb +++ b/actionpack/test/controller/base_test.rb @@ -2,68 +2,57 @@ require File.dirname(__FILE__) + '/../abstract_unit' require 'test/unit' require 'pp' # require 'pp' early to prevent hidden_methods from not picking up the pretty-print methods until too late -# This file currently contains a few controller UTs -# I couldn't find where the current base tests are, so I created this file. -# If there aren't any base-specific UTs, then this file should grow as they -# are written. If there are, or there is a better place for these, then I will -# move them to the correct location. -# -# Nicholas Seckar aka. Ulysses - -# Provide a static version of the Controllers module instead of the auto-loading version. -# We don't want these tests to fail when dependencies are to blame. -module Controllers - module Submodule - class ContainedEmptyController < ActionController::Base - end - class ContainedNonEmptyController < ActionController::Base - def public_action - end - - hide_action :hidden_action - def hidden_action - end - - def another_hidden_action - end - hide_action :another_hidden_action - end - class SubclassedController < ContainedNonEmptyController - hide_action :public_action # Hiding it here should not affect the superclass. - end - end - class EmptyController < ActionController::Base - include ActionController::Caching +# Provide some controller to run the tests on. +module Submodule + class ContainedEmptyController < ActionController::Base end - class NonEmptyController < ActionController::Base + class ContainedNonEmptyController < ActionController::Base def public_action end hide_action :hidden_action def hidden_action end + + def another_hidden_action + end + hide_action :another_hidden_action + end + class SubclassedController < ContainedNonEmptyController + hide_action :public_action # Hiding it here should not affect the superclass. + end +end +class EmptyController < ActionController::Base + include ActionController::Caching +end +class NonEmptyController < ActionController::Base + def public_action + end + + hide_action :hidden_action + def hidden_action end end class ControllerClassTests < Test::Unit::TestCase def test_controller_path - assert_equal 'empty', Controllers::EmptyController.controller_path - assert_equal 'submodule/contained_empty', Controllers::Submodule::ContainedEmptyController.controller_path + assert_equal 'empty', EmptyController.controller_path + assert_equal 'submodule/contained_empty', Submodule::ContainedEmptyController.controller_path end def test_controller_name - assert_equal 'empty', Controllers::EmptyController.controller_name - assert_equal 'contained_empty', Controllers::Submodule::ContainedEmptyController.controller_name + assert_equal 'empty', EmptyController.controller_name + assert_equal 'contained_empty', Submodule::ContainedEmptyController.controller_name end end class ControllerInstanceTests < Test::Unit::TestCase def setup - @empty = Controllers::EmptyController.new - @contained = Controllers::Submodule::ContainedEmptyController.new - @empty_controllers = [@empty, @contained, Controllers::Submodule::SubclassedController.new] + @empty = EmptyController.new + @contained = Submodule::ContainedEmptyController.new + @empty_controllers = [@empty, @contained, Submodule::SubclassedController.new] - @non_empty_controllers = [Controllers::NonEmptyController.new, - Controllers::Submodule::ContainedNonEmptyController.new] + @non_empty_controllers = [NonEmptyController.new, + Submodule::ContainedNonEmptyController.new] end def test_action_methods diff --git a/actionpack/test/controller/benchmark_test.rb b/actionpack/test/controller/benchmark_test.rb index 7e19376101..f346e575e3 100644 --- a/actionpack/test/controller/benchmark_test.rb +++ b/actionpack/test/controller/benchmark_test.rb @@ -1,17 +1,14 @@ require File.dirname(__FILE__) + '/../abstract_unit' require 'test/unit' -# Provide a static version of the Controllers module instead of the auto-loading version. -# We don't want these tests to fail when dependencies are to blame. -module Controllers - class BenchmarkedController < ActionController::Base - def public_action - render :nothing => true - end +# Provide some static controllers. +class BenchmarkedController < ActionController::Base + def public_action + render :nothing => true + end - def rescue_action(e) - raise e - end + def rescue_action(e) + raise e end end @@ -22,7 +19,7 @@ class BenchmarkTest < Test::Unit::TestCase end def setup - @controller = Controllers::BenchmarkedController.new + @controller = BenchmarkedController.new # benchmark doesn't do anything unless a logger is set @controller.logger = MockLogger.new @request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new -- cgit v1.2.3