aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2013-12-10 15:22:31 +0100
committerYves Senn <yves.senn@gmail.com>2013-12-10 15:22:31 +0100
commite74a9f9eea4fd2dee7fb2e65c95c713d11f4cdcc (patch)
tree973b86e79b83933a579adf4e15b293c1befaddd2 /activesupport
parent821153525cefb1a809be06ae584f24f5c0c11323 (diff)
downloadrails-e74a9f9eea4fd2dee7fb2e65c95c713d11f4cdcc.tar.gz
rails-e74a9f9eea4fd2dee7fb2e65c95c713d11f4cdcc.tar.bz2
rails-e74a9f9eea4fd2dee7fb2e65c95c713d11f4cdcc.zip
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
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/testing/deprecation.rb21
1 files changed, 10 insertions, 11 deletions
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