silenced writer

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4978 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper
2006-09-04 05:55:55 +00:00
parent da8d7a7011
commit 7269b086e1
2 changed files with 8 additions and 1 deletions

View File

@@ -46,6 +46,9 @@ module ActiveSupport
@silenced = old_silenced
end
attr_writer :silenced
private
def deprecation_message(callstack, message = nil)
file, line, method = extract_callstack(callstack)

View File

@@ -9,7 +9,7 @@ class Deprecatee
def old_request; @request end
def partially(foo = nil)
ActiveSupport::Deprecation.warn 'calling with foo=nil is out' if foo.nil?
ActiveSupport::Deprecation.warn('calling with foo=nil is out', caller) if foo.nil?
end
def not() 2 end
@@ -82,5 +82,9 @@ class DeprecationTest < Test::Unit::TestCase
ActiveSupport::Deprecation.silence do
assert_not_deprecated { @dtc.partially }
end
ActiveSupport::Deprecation.silenced = true
assert_not_deprecated { @dtc.partially }
ActiveSupport::Deprecation.silenced = false
end
end