diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-01-15 23:21:08 -0200 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-01-17 18:07:08 -0200 |
commit | 20baeece919629b7e43b86aebb05f8e2af6d19ef (patch) | |
tree | 2b3516ccb6f5cdf7571a75d82797b71eb7ca1986 | |
parent | 57f73a6bcf3311262172f1f348a1be614596b41a (diff) | |
download | rails-20baeece919629b7e43b86aebb05f8e2af6d19ef.tar.gz rails-20baeece919629b7e43b86aebb05f8e2af6d19ef.tar.bz2 rails-20baeece919629b7e43b86aebb05f8e2af6d19ef.zip |
Add some deprecations for logic being removed in 4.0
-rw-r--r-- | actionpack/lib/action_controller/metal/compatibility.rb | 17 | ||||
-rw-r--r-- | actionpack/test/controller/base_test.rb | 12 | ||||
-rw-r--r-- | actionpack/test/controller/caching_test.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/render_test.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/view_paths_test.rb | 7 |
5 files changed, 25 insertions, 15 deletions
diff --git a/actionpack/lib/action_controller/metal/compatibility.rb b/actionpack/lib/action_controller/metal/compatibility.rb index 05dca445a4..76292db0b3 100644 --- a/actionpack/lib/action_controller/metal/compatibility.rb +++ b/actionpack/lib/action_controller/metal/compatibility.rb @@ -1,3 +1,5 @@ +require 'active_support/deprecation' + module ActionController module Compatibility extend ActiveSupport::Concern @@ -24,13 +26,19 @@ module ActionController ) def rescue_action(env) + ActiveSupport::Deprecation.warn "Calling `rescue_action` is deprecated and will be removed in Rails 4.0.", caller raise env["action_dispatch.rescue.exception"] end end # For old tests - def initialize_template_class(*) end - def assign_shortcuts(*) end + def initialize_template_class(*) + ActiveSupport::Deprecation.warn "Calling `initialize_template_class` is deprecated and has no effect anymore.", caller + end + + def assign_shortcuts(*) + ActiveSupport::Deprecation.warn "Calling `assign_shortcuts` is deprecated and has no effect anymore.", caller + end def _normalize_options(options) options[:text] = nil if options.delete(:nothing) == true @@ -44,6 +52,9 @@ module ActionController end def _handle_method_missing + ActiveSupport::Deprecation.warn "Using `method_missing` to handle non" \ + " existing actions is deprecated and will be removed in Rails 4.0, " \ + " please use `action_missing` instead.", caller method_missing(@_action_name.to_sym) end @@ -52,6 +63,8 @@ module ActionController end def performed? + ActiveSupport::Deprecation.warn "Calling `performed?` is deprecated and will " \ + "be removed in Rails 4.0. Please check for `response_body` presence instead.", caller response_body end end diff --git a/actionpack/test/controller/base_test.rb b/actionpack/test/controller/base_test.rb index f2b054c849..b11fc02604 100644 --- a/actionpack/test/controller/base_test.rb +++ b/actionpack/test/controller/base_test.rb @@ -161,7 +161,9 @@ class PerformActionTest < ActionController::TestCase def test_get_on_priv_should_show_selector use_controller MethodMissingController - get :shouldnt_be_called + assert_deprecated /Using `method_missing` to handle .* use `action_missing` instead/ do + get :shouldnt_be_called + end assert_response :success assert_equal 'shouldnt_be_called', @response.body end @@ -170,14 +172,18 @@ class PerformActionTest < ActionController::TestCase use_controller MethodMissingController assert !@controller.__send__(:action_method?, 'method_missing') - get :method_missing + assert_deprecated /Using `method_missing` to handle .* use `action_missing` instead/ do + get :method_missing + end assert_response :success assert_equal 'method_missing', @response.body end def test_method_missing_should_recieve_symbol use_controller AnotherMethodMissingController - get :some_action + assert_deprecated /Using `method_missing` to handle .* use `action_missing` instead/ do + get :some_action + end assert_kind_of NameError, @controller._exception end diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb index 34a38a5567..443b56830a 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 diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index f42a04d670..0bac073154 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 diff --git a/actionpack/test/controller/view_paths_test.rb b/actionpack/test/controller/view_paths_test.rb index f5ac886c20..04f550ae1e 100644 --- a/actionpack/test/controller/view_paths_test.rb +++ b/actionpack/test/controller/view_paths_test.rb @@ -22,16 +22,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 |