Skip to content
Browse files

Merge [5728] from trunk.

git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/1-2-pre-release@5729 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 72d556a commit d5ca9a5814b5259a4acac048fdcc445ac84aa9b8 @jeremy jeremy committed Dec 17, 2006
View
7 activesupport/CHANGELOG
@@ -1,9 +1,8 @@
-*SVN*
-
-* Fix remove_constant to correctly handle constant names of the form "::A::...". References #6720. [Nicholas Seckar]
+*1.4.0 RC2*
+* Deprecation: silence warnings when reporting test errors. [Jeremy Kemper]
-*1.4.0 RC2*
+* Fix remove_constant to correctly handle constant names of the form "::A::...". References #6720. [Nicholas Seckar]
* Fixed Array#to_xml when it contains a series of hashes (each piece would get its own XML declaration) #6610 [thkarcher/cyu]
View
13 activesupport/lib/active_support/deprecation.rb
@@ -172,10 +172,23 @@ class Module
include ActiveSupport::Deprecation::ClassMethods
end
+require 'test/unit'
+
module Test
module Unit
class TestCase
include ActiveSupport::Deprecation::Assertions
end
+
+ class Error # :nodoc:
+ # Silence warnings when reporting test errors.
+ def message_with_silenced_deprecation
+ ActiveSupport::Deprecation.silence do
+ message_without_silenced_deprecation
+ end
+ end
+
+ alias_method_chain :message, :silenced_deprecation
+ end
end
end
View
16 activesupport/test/deprecation_test.rb
@@ -128,4 +128,20 @@ def test_deprecation_with_alternate_method
def test_deprecation_with_explicit_message
assert_deprecated(/you now need to do something extra for this one/) { @dtc.d }
end
+
+ def test_assertion_failed_error_doesnt_spout_deprecation_warnings
+ error_class = Class.new(StandardError) do
+ def message
+ ActiveSupport::Deprecation.warn 'warning in error message'
+ super
+ end
+ end
+
+ raise error_class.new('hmm')
+
+ rescue => e
+ error = Test::Unit::Error.new('testing ur doodz', e)
+ assert_not_deprecated { error.message }
+ assert_nil @last_message
+ end
end

0 comments on commit d5ca9a5

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