Skip to content
Browse files

silenced writer

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4978 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent da8d7a7 commit 7269b086e1c3c6d43c97458efcc7c5c54a322b33 @jeremy jeremy committed Sep 4, 2006
Showing with 8 additions and 1 deletion.
  1. +3 −0 activesupport/lib/active_support/deprecation.rb
  2. +5 −1 activesupport/test/deprecation_test.rb
View
3 activesupport/lib/active_support/deprecation.rb
@@ -46,6 +46,9 @@ def silence
@silenced = old_silenced
end
+ attr_writer :silenced
+
+
private
def deprecation_message(callstack, message = nil)
file, line, method = extract_callstack(callstack)
View
6 activesupport/test/deprecation_test.rb
@@ -9,7 +9,7 @@ def request; @_request end
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 @@ def test_silence
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

0 comments on commit 7269b08

Please sign in to comment.
Something went wrong with that request. Please try again.