From f413be58b68dbc7613422ec4b98f02404e873330 Mon Sep 17 00:00:00 2001 From: Joshua Nichols Date: Sat, 8 Aug 2009 16:31:47 -0400 Subject: [PATCH] An attempt to provide a more useful line of deprecated use for [#2932] - It cleans the backtrace in ActiveSpport::Deprecation --- .../test/controller/action_pack_assertions_test.rb | 20 ++++++++++++++++++++ activesupport/lib/active_support/deprecation.rb | 1 + 2 files changed, 21 insertions(+), 0 deletions(-) diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb index 6e92eff..fce43b2 100644 --- a/actionpack/test/controller/action_pack_assertions_test.rb +++ b/actionpack/test/controller/action_pack_assertions_test.rb @@ -157,6 +157,10 @@ module Admin redirect_to :controller => '/content' end + def redirect_to_index_with_hash + redirect_to :controller => 'admin/inner_module', :action => :index + end + def redirect_to_fellow_controller redirect_to :controller => 'user' end @@ -288,6 +292,22 @@ class ActionPackAssertionsControllerTest < ActionController::TestCase end end + def test_assert_redirected_to_deprecation_of_partial_hash + with_routing do |set| + set.draw do |map| + map.connect ':controller/:action/:id' + end + end + + @controller = Admin::InnerModuleController.new + process :redirect_to_index_with_hash + + # want it deprecated, with the line that invoked it + assert_deprecated /action_pack_assertion_test/ do + assert_redirected_to :action => :index + end + end + # -- standard request/response object testing -------------------------------- # make sure that the template objects exist diff --git a/activesupport/lib/active_support/deprecation.rb b/activesupport/lib/active_support/deprecation.rb index d201516..1bad737 100644 --- a/activesupport/lib/active_support/deprecation.rb +++ b/activesupport/lib/active_support/deprecation.rb @@ -67,6 +67,7 @@ module ActiveSupport end def extract_callstack(callstack) + callstack = Rails.backtrace_cleaner.clean(callstack) if md = callstack.first.match(/^(.+?):(\d+)(?::in `(.*?)')?/) md.captures else -- 1.6.4