Skip to content

Commit d96550b

Browse files
author
Tara Scherner de la Fuente
committed
add deprecation warning to assert_nothing_raised and changelog entry
1 parent 640ef22 commit d96550b

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

activesupport/CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
* Deprecate arguments on `assert_nothing_raised`.
2+
3+
`assert_nothing_raised` does not assert the arguments that have been passed
4+
in (usually a specific exception class) since the method only yields the
5+
block. So as not to confuse the users that the arguments have meaning, they
6+
are being deprecated.
7+
8+
*Tara Scherner de la Fuente*
9+
110
* Make `benchmark('something', silence: true)` actually work
211

312
*DHH*
@@ -6,7 +15,7 @@
615

716
`#on_weekday?` returns `true` if the receiving date/time does not fall on a Saturday
817
or Sunday.
9-
18+
1019
*Vipul A M*
1120

1221
* Add `Array#second_to_last` and `Array#third_to_last` methods.

activesupport/lib/active_support/test_case.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ def test_order
7474
# assert_nothing_raised do
7575
# perform_service(param: 'no_exception')
7676
# end
77-
def assert_nothing_raised
77+
def assert_nothing_raised(*args)
78+
if args.present?
79+
ActiveSupport::Deprecation.warn("Passing arguments to assert_nothing_raised
80+
is deprecated and will be removed in Rails 5.1.")
81+
end
7882
yield
7983
end
8084
end

0 commit comments

Comments
 (0)