diff options
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/assert_select_test.rb | 4 | ||||
-rw-r--r-- | actionpack/test/controller/base_test.rb | 49 | ||||
-rw-r--r-- | actionpack/test/controller/caching_test.rb | 6 | ||||
-rw-r--r-- | actionpack/test/controller/capture_test.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/content_type_test.rb | 10 | ||||
-rw-r--r-- | actionpack/test/controller/filters_test.rb | 14 | ||||
-rw-r--r-- | actionpack/test/controller/flash_test.rb | 4 | ||||
-rw-r--r-- | actionpack/test/controller/helper_test.rb | 7 | ||||
-rw-r--r-- | actionpack/test/controller/mime_responds_test.rb | 6 | ||||
-rw-r--r-- | actionpack/test/controller/redirect_test.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/render_test.rb | 16 | ||||
-rw-r--r-- | actionpack/test/controller/request_forgery_protection_test.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/resources_test.rb | 1 | ||||
-rw-r--r-- | actionpack/test/controller/routing_test.rb | 1 | ||||
-rw-r--r-- | actionpack/test/controller/test_case_test.rb | 23 | ||||
-rw-r--r-- | actionpack/test/controller/view_paths_test.rb | 8 | ||||
-rw-r--r-- | actionpack/test/controller/webservice_test.rb | 2 |
17 files changed, 23 insertions, 134 deletions
diff --git a/actionpack/test/controller/assert_select_test.rb b/actionpack/test/controller/assert_select_test.rb index 5eef8a32d7..d3359e79a6 100644 --- a/actionpack/test/controller/assert_select_test.rb +++ b/actionpack/test/controller/assert_select_test.rb @@ -47,10 +47,6 @@ class AssertSelectTest < ActionController::TestCase render :text=>@content, :layout=>false, :content_type=>Mime::XML @content = nil end - - def rescue_action(e) - raise e - end end tests AssertSelectController diff --git a/actionpack/test/controller/base_test.rb b/actionpack/test/controller/base_test.rb index c5c48bc559..b95a524612 100644 --- a/actionpack/test/controller/base_test.rb +++ b/actionpack/test/controller/base_test.rb @@ -40,29 +40,6 @@ class NonEmptyController < ActionController::Base end end -class MethodMissingController < ActionController::Base - hide_action :shouldnt_be_called - def shouldnt_be_called - raise "NO WAY!" - end - -protected - - def method_missing(selector) - render :text => selector.to_s - end -end - -class AnotherMethodMissingController < ActionController::Base - cattr_accessor :_exception - rescue_from Exception, :with => :_exception= - - protected - def method_missing(*attrs, &block) - super - end -end - class DefaultUrlOptionsController < ActionController::Base def from_view render :inline => "<%= #{params[:route]} %>" @@ -159,32 +136,10 @@ class PerformActionTest < ActionController::TestCase assert_equal exception.message, "The action 'non_existent' could not be found for EmptyController" end - def test_get_on_priv_should_show_selector - use_controller MethodMissingController - get :shouldnt_be_called - assert_response :success - assert_equal 'shouldnt_be_called', @response.body - end - - def test_method_missing_is_not_an_action_name - use_controller MethodMissingController - assert !@controller.__send__(:action_method?, 'method_missing') - - get :method_missing - assert_response :success - assert_equal 'method_missing', @response.body - end - - def test_method_missing_should_recieve_symbol - use_controller AnotherMethodMissingController - get :some_action - assert_kind_of NameError, @controller._exception - end - def test_get_on_hidden_should_fail use_controller NonEmptyController - assert_raise(ActionController::UnknownAction) { get :hidden_action } - assert_raise(ActionController::UnknownAction) { get :another_hidden_action } + assert_raise(AbstractController::ActionNotFound) { get :hidden_action } + assert_raise(AbstractController::ActionNotFound) { get :another_hidden_action } end end diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb index 34a38a5567..bb4fb7bf07 100644 --- a/actionpack/test/controller/caching_test.rb +++ b/actionpack/test/controller/caching_test.rb @@ -686,8 +686,6 @@ class FragmentCachingTest < ActionController::TestCase @controller.params = @params @controller.request = @request @controller.response = @response - @controller.send(:initialize_template_class, @response) - @controller.send(:assign_shortcuts, @request, @response) end def test_fragment_cache_key @@ -795,10 +793,6 @@ class FunctionalCachingController < CachingController format.xml end end - - def rescue_action(e) - raise e - end end class FunctionalFragmentCachingTest < ActionController::TestCase diff --git a/actionpack/test/controller/capture_test.rb b/actionpack/test/controller/capture_test.rb index a217510434..72263156d9 100644 --- a/actionpack/test/controller/capture_test.rb +++ b/actionpack/test/controller/capture_test.rb @@ -28,8 +28,6 @@ class CaptureController < ActionController::Base def proper_block_detection @todo = "some todo" end - - def rescue_action(e) raise end end class CaptureTest < ActionController::TestCase diff --git a/actionpack/test/controller/content_type_test.rb b/actionpack/test/controller/content_type_test.rb index a312b7c32a..03d5d27cf4 100644 --- a/actionpack/test/controller/content_type_test.rb +++ b/actionpack/test/controller/content_type_test.rb @@ -48,8 +48,6 @@ class OldContentTypeController < ActionController::Base format.rss { render :text => "hello world!", :content_type => Mime::XML } end end - - def rescue_action(e) raise end end class ContentTypeTest < ActionController::TestCase @@ -70,12 +68,12 @@ class ContentTypeTest < ActionController::TestCase end def test_render_changed_charset_default - OldContentTypeController.default_charset = "utf-16" + ActionDispatch::Response.default_charset = "utf-16" get :render_defaults assert_equal "utf-16", @response.charset assert_equal Mime::HTML, @response.content_type ensure - OldContentTypeController.default_charset = "utf-8" + ActionDispatch::Response.default_charset = "utf-8" end # :ported: @@ -107,12 +105,12 @@ class ContentTypeTest < ActionController::TestCase end def test_nil_default_for_erb - OldContentTypeController.default_charset = nil + ActionDispatch::Response.default_charset = nil get :render_default_for_erb assert_equal Mime::HTML, @response.content_type assert_nil @response.charset, @response.headers.inspect ensure - OldContentTypeController.default_charset = "utf-8" + ActionDispatch::Response.default_charset = "utf-8" end def test_default_for_erb diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb index 9ad0dc75f5..046396b37c 100644 --- a/actionpack/test/controller/filters_test.rb +++ b/actionpack/test/controller/filters_test.rb @@ -165,8 +165,6 @@ class FilterTest < ActionController::TestCase @ran_filter ||= [] @ran_filter << "clean_up_tmp" end - - def rescue_action(e) raise(e) end end class ConditionalCollectionFilterController < ConditionalFilterController @@ -454,11 +452,6 @@ class FilterTest < ActionController::TestCase def show raise ErrorToRescue.new("Something made the bad noise.") end - - private - def rescue_action(exception) - raise exception - end end class NonYieldingAroundFilterController < ActionController::Base @@ -472,9 +465,6 @@ class FilterTest < ActionController::TestCase render :inline => "index" end - #make sure the controller complains - def rescue_action(e); raise e; end - private def filter_one @@ -825,11 +815,7 @@ class FilterTest < ActionController::TestCase end end - - class PostsController < ActionController::Base - def rescue_action(e); raise e; end - module AroundExceptions class Error < StandardError ; end class Before < Error ; end diff --git a/actionpack/test/controller/flash_test.rb b/actionpack/test/controller/flash_test.rb index d497913dc4..37ccc7a4a5 100644 --- a/actionpack/test/controller/flash_test.rb +++ b/actionpack/test/controller/flash_test.rb @@ -51,10 +51,6 @@ class FlashTest < ActionController::TestCase render :inline => "hello" end - def rescue_action(e) - raise unless ActionView::MissingTemplate === e - end - # methods for test_sweep_after_halted_filter_chain before_filter :halt_and_redir, :only => "filter_halting_action" diff --git a/actionpack/test/controller/helper_test.rb b/actionpack/test/controller/helper_test.rb index 35a87c1aae..757661d8d0 100644 --- a/actionpack/test/controller/helper_test.rb +++ b/actionpack/test/controller/helper_test.rb @@ -7,16 +7,12 @@ module Fun def render_hello_world render :inline => "hello: <%= stratego %>" end - - def rescue_action(e) raise end end class PdfController < ActionController::Base def test render :inline => "test: <%= foobar %>" end - - def rescue_action(e) raise end end end @@ -60,7 +56,6 @@ class HelperTest < ActiveSupport::TestCase class TestController < ActionController::Base attr_accessor :delegate_attr def delegate_method() end - def rescue_action(e) raise end end def setup @@ -201,8 +196,6 @@ class IsolatedHelpersTest < ActiveSupport::TestCase def index render :inline => '<%= shout %>' end - - def rescue_action(e) raise end end class B < A diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb index 76a8c89e60..60498822ff 100644 --- a/actionpack/test/controller/mime_responds_test.rb +++ b/actionpack/test/controller/mime_responds_test.rb @@ -151,10 +151,6 @@ class RespondToController < ActionController::Base end end - def rescue_action(e) - raise - end - protected def set_layout if action_name.in?(["all_types_with_layout", "iphone_with_html_response_type"]) @@ -498,7 +494,7 @@ class RespondToControllerTest < ActionController::TestCase assert_equal '<html><div id="iphone">Hello iPhone future from iPhone!</div></html>', @response.body assert_equal "text/html", @response.content_type end - + def test_invalid_format get :using_defaults, :format => "invalidformat" assert_equal " ", @response.body diff --git a/actionpack/test/controller/redirect_test.rb b/actionpack/test/controller/redirect_test.rb index 5b739e49ac..b1d76150f8 100644 --- a/actionpack/test/controller/redirect_test.rb +++ b/actionpack/test/controller/redirect_test.rb @@ -105,8 +105,6 @@ class RedirectController < ActionController::Base def rescue_errors(e) raise e end - def rescue_action(e) raise end - protected def dashbord_url(id, message) url_for :action => "dashboard", :params => { "id" => id, "message" => message } diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index ec26315dc7..8c2d622304 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -54,7 +54,7 @@ class TestController < ActionController::Base def conditional_hello_with_record record = Struct.new(:updated_at, :cache_key).new(Time.now.utc.beginning_of_day, "foo/123") - + if stale?(record) render :action => 'hello_world' end @@ -649,10 +649,6 @@ class TestController < ActionController::Base render :action => "calling_partial_with_layout", :layout => "layouts/partial_with_layout" end - def rescue_action(e) - raise - end - before_filter :only => :render_with_filters do request.format = :xml end @@ -891,12 +887,12 @@ class RenderTest < ActionController::TestCase # :ported: def test_attempt_to_access_object_method - assert_raise(ActionController::UnknownAction, "No action responded to [clone]") { get :clone } + assert_raise(AbstractController::ActionNotFound, "No action responded to [clone]") { get :clone } end # :ported: def test_private_methods - assert_raise(ActionController::UnknownAction, "No action responded to [determine_layout]") { get :determine_layout } + assert_raise(AbstractController::ActionNotFound, "No action responded to [determine_layout]") { get :determine_layout } end # :ported: @@ -1096,15 +1092,15 @@ class RenderTest < ActionController::TestCase # :ported: def test_double_render - assert_raise(ActionController::DoubleRenderError) { get :double_render } + assert_raise(AbstractController::DoubleRenderError) { get :double_render } end def test_double_redirect - assert_raise(ActionController::DoubleRenderError) { get :double_redirect } + assert_raise(AbstractController::DoubleRenderError) { get :double_redirect } end def test_render_and_redirect - assert_raise(ActionController::DoubleRenderError) { get :render_and_redirect } + assert_raise(AbstractController::DoubleRenderError) { get :render_and_redirect } end # specify the one exception to double render rule - render_to_string followed by render diff --git a/actionpack/test/controller/request_forgery_protection_test.rb b/actionpack/test/controller/request_forgery_protection_test.rb index fd5a41a0bb..4a291582d8 100644 --- a/actionpack/test/controller/request_forgery_protection_test.rb +++ b/actionpack/test/controller/request_forgery_protection_test.rb @@ -36,8 +36,6 @@ module RequestForgeryProtectionActions def form_for_without_protection render :inline => "<%= form_for(:some_resource, :authenticity_token => false ) {} %>" end - - def rescue_action(e) raise e end end # sample controllers diff --git a/actionpack/test/controller/resources_test.rb b/actionpack/test/controller/resources_test.rb index 6b8a8f6161..73d72fe4d6 100644 --- a/actionpack/test/controller/resources_test.rb +++ b/actionpack/test/controller/resources_test.rb @@ -6,7 +6,6 @@ require 'active_support/core_ext/object/inclusion' class ResourcesController < ActionController::Base def index() render :nothing => true end alias_method :show, :index - def rescue_action(e) raise e end end class ThreadsController < ResourcesController; end diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index bf33b8cdd7..bec9eb16f3 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -6,7 +6,6 @@ require 'active_support/core_ext/object/with_options' class MilestonesController < ActionController::Base def index() head :ok end alias_method :show, :index - def rescue_action(e) raise e end end ROUTING = ActionDispatch::Routing diff --git a/actionpack/test/controller/test_case_test.rb b/actionpack/test/controller/test_case_test.rb index 34b06df8d8..caf76c7e61 100644 --- a/actionpack/test/controller/test_case_test.rb +++ b/actionpack/test/controller/test_case_test.rb @@ -2,7 +2,7 @@ require 'abstract_unit' require 'controller/fake_controllers' require 'active_support/ordered_hash' -class TestTest < ActionController::TestCase +class TestCaseTest < ActionController::TestCase class TestController < ActionController::Base def no_op render :text => 'dummy' @@ -124,9 +124,6 @@ XML end private - def rescue_action(e) - raise e - end def generate_url(opts) url_for(opts.merge(:action => "test_uri")) @@ -174,7 +171,7 @@ XML def test_document_body_and_params_with_post post :test_params, :id => 1 - assert_equal("{\"id\"=>\"1\", \"controller\"=>\"test_test/test\", \"action\"=>\"test_params\"}", @response.body) + assert_equal("{\"id\"=>\"1\", \"controller\"=>\"test_case_test/test\", \"action\"=>\"test_params\"}", @response.body) end def test_document_body_with_post @@ -247,18 +244,18 @@ XML def test_process_with_request_uri_with_no_params process :test_uri - assert_equal "/test_test/test/test_uri", @response.body + assert_equal "/test_case_test/test/test_uri", @response.body end def test_process_with_request_uri_with_params process :test_uri, "GET", :id => 7 - assert_equal "/test_test/test/test_uri/7", @response.body + assert_equal "/test_case_test/test/test_uri/7", @response.body end def test_process_with_old_api assert_deprecated do process :test_uri, :id => 7 - assert_equal "/test_test/test/test_uri/7", @response.body + assert_equal "/test_case_test/test/test_uri/7", @response.body end end @@ -542,7 +539,7 @@ XML get :test_params, :page => {:name => "Page name", :month => '4', :year => '2004', :day => '6'} parsed_params = eval(@response.body) assert_equal( - {'controller' => 'test_test/test', 'action' => 'test_params', + {'controller' => 'test_case_test/test', 'action' => 'test_params', 'page' => {'name' => "Page name", 'month' => '4', 'year' => '2004', 'day' => '6'}}, parsed_params ) @@ -552,7 +549,7 @@ XML get :test_params, :page => {:name => "Page name", :month => 4, :year => 2004, :day => 6} parsed_params = eval(@response.body) assert_equal( - {'controller' => 'test_test/test', 'action' => 'test_params', + {'controller' => 'test_case_test/test', 'action' => 'test_params', 'page' => {'name' => "Page name", 'month' => '4', 'year' => '2004', 'day' => '6'}}, parsed_params ) @@ -564,7 +561,7 @@ XML end parsed_params = eval(@response.body) assert_equal( - {'controller' => 'test_test/test', 'action' => 'test_params', + {'controller' => 'test_case_test/test', 'action' => 'test_params', 'frozen' => 'icy', 'frozens' => ['icy']}, parsed_params ) @@ -584,7 +581,7 @@ XML def test_array_path_parameter_handled_properly with_routing do |set| set.draw do - match 'file/*path', :to => 'test_test/test#test_params' + match 'file/*path', :to => 'test_case_test/test#test_params' match ':controller/:action' end @@ -719,7 +716,7 @@ XML end def test_fixture_path_is_accessed_from_self_instead_of_active_support_test_case - TestTest.stubs(:fixture_path).returns(FILES_DIR) + TestCaseTest.stubs(:fixture_path).returns(FILES_DIR) uploaded_file = fixture_file_upload('/mona_lisa.jpg', 'image/png') assert_equal File.open("#{FILES_DIR}/mona_lisa.jpg", READ_PLAIN).read, uploaded_file.read diff --git a/actionpack/test/controller/view_paths_test.rb b/actionpack/test/controller/view_paths_test.rb index 872f171c42..40f6dc6f0f 100644 --- a/actionpack/test/controller/view_paths_test.rb +++ b/actionpack/test/controller/view_paths_test.rb @@ -3,7 +3,6 @@ require 'abstract_unit' class ViewLoadPathsTest < ActionController::TestCase class TestController < ActionController::Base def self.controller_path() "test" end - def rescue_action(e) raise end before_filter :add_view_path, :only => :hello_world_at_request_time @@ -24,16 +23,9 @@ class ViewLoadPathsTest < ActionController::TestCase end def setup - # TestController.view_paths = nil - @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new - @controller = TestController.new - # Following is needed in order to setup @controller.template object properly - @controller.send :assign_shortcuts, @request, @response - @controller.send :initialize_template_class, @response - @paths = TestController.view_paths end diff --git a/actionpack/test/controller/webservice_test.rb b/actionpack/test/controller/webservice_test.rb index ae8588cbb0..351e61eeae 100644 --- a/actionpack/test/controller/webservice_test.rb +++ b/actionpack/test/controller/webservice_test.rb @@ -18,8 +18,6 @@ class WebServiceTest < ActionDispatch::IntegrationTest s << "#{k}#{value}" end end - - def rescue_action(e) raise end end def setup |