aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTara Scherner de la Fuente <tara.scherner@livingsocial.com>2016-02-19 23:18:45 -0800
committerTara Scherner de la Fuente <tara.scherner@livingsocial.com>2016-02-22 22:56:23 -0800
commitd96550b53ecf3816dff3cb0d68dc976028dc9351 (patch)
tree841bdf899bb989e5cf038fa796119256e51e863c
parent640ef22b6738e64d502ca7443d325bd5dd096720 (diff)
downloadrails-d96550b53ecf3816dff3cb0d68dc976028dc9351.tar.gz
rails-d96550b53ecf3816dff3cb0d68dc976028dc9351.tar.bz2
rails-d96550b53ecf3816dff3cb0d68dc976028dc9351.zip
add deprecation warning to assert_nothing_raised and changelog entry
-rw-r--r--activesupport/CHANGELOG.md11
-rw-r--r--activesupport/lib/active_support/test_case.rb6
2 files changed, 15 insertions, 2 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md
index db8d279cff..2a5d203813 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 221e1171e7..2d2e25c970 100644
--- a/activesupport/lib/active_support/test_case.rb
+++ b/activesupport/lib/active_support/test_case.rb
@@ -74,7 +74,11 @@ module ActiveSupport
# 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