From e74a9f9eea4fd2dee7fb2e65c95c713d11f4cdcc Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Tue, 10 Dec 2013 15:22:31 +0100 Subject: make `collect_deprecations` available. There are circumstances where the capabilities of `assert_deprecated` and `assert_not_deprecated` are not enough. For example if a ccertain call-path raises two deprecations but should only raise a single one. This module is still :nodoc and intented for internal use. /cc @rafaelfranca --- .../lib/active_support/testing/deprecation.rb | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'activesupport/lib/active_support') diff --git a/activesupport/lib/active_support/testing/deprecation.rb b/activesupport/lib/active_support/testing/deprecation.rb index a8342904dc..6c94c611b6 100644 --- a/activesupport/lib/active_support/testing/deprecation.rb +++ b/activesupport/lib/active_support/testing/deprecation.rb @@ -19,18 +19,17 @@ module ActiveSupport result end - private - def collect_deprecations - old_behavior = ActiveSupport::Deprecation.behavior - deprecations = [] - ActiveSupport::Deprecation.behavior = Proc.new do |message, callstack| - deprecations << message - end - result = yield - [result, deprecations] - ensure - ActiveSupport::Deprecation.behavior = old_behavior + def collect_deprecations + old_behavior = ActiveSupport::Deprecation.behavior + deprecations = [] + ActiveSupport::Deprecation.behavior = Proc.new do |message, callstack| + deprecations << message end + result = yield + [result, deprecations] + ensure + ActiveSupport::Deprecation.behavior = old_behavior + end end end end -- cgit v1.2.3