Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 5763

Show
Ignore:
Timestamp:
12/20/06 21:28:31 (2 years ago)
Author:
bitsweat
Message:

DeprecatedInstanceVariable#inspect doesn't warn since test/unit, error logs, and others use it for diagnostics.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activesupport/lib/active_support/deprecation.rb

    r5740 r5763  
    144144    end 
    145145 
    146     # Stand-in for @request, @attributes, etc. 
     146    # Stand-in for @request, @attributes, @params, etc which emits deprecation 
     147    # warnings on any method call (except #inspect). 
    147148    class DeprecatedInstanceVariableProxy 
    148149      instance_methods.each { |m| undef_method m unless m =~ /^__/ } 
     
    150151      def initialize(instance, method, var = "@#{method}") 
    151152        @instance, @method, @var = instance, method, var 
     153      end 
     154 
     155      # Don't give a deprecation warning on inspect since test/unit and error 
     156      # logs rely on it for diagnostics. 
     157      def inspect 
     158        target.inspect 
    152159      end 
    153160 
  • trunk/activesupport/test/deprecation_test.rb

    r5728 r5763  
    8080  end 
    8181 
     82  def test_deprecated_instance_variable_proxy_shouldnt_warn_on_inspect 
     83    assert_not_deprecated { assert_equal @dtc.request.inspect, @dtc.old_request.inspect } 
     84  end 
     85 
    8286  def test_assert_deprecation_without_match 
    8387    assert_deprecated do