From d96550b53ecf3816dff3cb0d68dc976028dc9351 Mon Sep 17 00:00:00 2001 From: Tara Scherner de la Fuente Date: Fri, 19 Feb 2016 23:18:45 -0800 Subject: [PATCH] add deprecation warning to assert_nothing_raised and changelog entry --- activesupport/CHANGELOG.md | 11 ++++++++++- activesupport/lib/active_support/test_case.rb | 6 +++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index db8d279cffddb..2a5d2038132f3 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,3 +1,12 @@ +* Deprecate arguments on `assert_nothing_raised`. + + `assert_nothing_raised` does not assert the arguments that have been passed + in (usually a specific exception class) since the method only yields the + block. So as not to confuse the users that the arguments have meaning, they + are being deprecated. + + *Tara Scherner de la Fuente* + * Make `benchmark('something', silence: true)` actually work *DHH* @@ -6,7 +15,7 @@ `#on_weekday?` returns `true` if the receiving date/time does not fall on a Saturday or Sunday. - + *Vipul A M* * Add `Array#second_to_last` and `Array#third_to_last` methods. diff --git a/activesupport/lib/active_support/test_case.rb b/activesupport/lib/active_support/test_case.rb index 221e1171e7e9b..2d2e25c970b7a 100644 --- a/activesupport/lib/active_support/test_case.rb +++ b/activesupport/lib/active_support/test_case.rb @@ -74,7 +74,11 @@ def test_order # assert_nothing_raised do # perform_service(param: 'no_exception') # end - def assert_nothing_raised + def assert_nothing_raised(*args) + if args.present? + ActiveSupport::Deprecation.warn("Passing arguments to assert_nothing_raised + is deprecated and will be removed in Rails 5.1.") + end yield end end