Browse files

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
  • Loading branch information...
1 parent 8211535 commit e74a9f9eea4fd2dee7fb2e65c95c713d11f4cdcc @senny senny committed Dec 10, 2013
Showing with 10 additions and 11 deletions.
  1. +10 −11 activesupport/lib/active_support/testing/deprecation.rb
View
21 activesupport/lib/active_support/testing/deprecation.rb
@@ -19,18 +19,17 @@ def assert_not_deprecated(&block)
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

0 comments on commit e74a9f9

Please sign in to comment.