From 3cece0b6574c496605df055a2ebf77177f5b6e7f Mon Sep 17 00:00:00 2001 From: Santosh Wadghule Date: Sat, 27 Aug 2016 08:33:08 +0530 Subject: Move custom assertion to its proper place ActiveSupport::Testing::Assertions. We have a separate module in which have defined Rails' own custom assertions. So it would be good to keep all custom Rails' assertions in one place i.e. in this module. --- activesupport/lib/active_support/test_case.rb | 11 ----------- activesupport/lib/active_support/testing/assertions.rb | 11 +++++++++++ 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/test_case.rb b/activesupport/lib/active_support/test_case.rb index a8e98b704a..1c599b8851 100644 --- a/activesupport/lib/active_support/test_case.rb +++ b/activesupport/lib/active_support/test_case.rb @@ -65,16 +65,5 @@ module ActiveSupport alias :assert_not_predicate :refute_predicate alias :assert_not_respond_to :refute_respond_to alias :assert_not_same :refute_same - - # Assertion that the block should not raise an exception. - # - # Passes if evaluated code in the yielded block raises no exception. - # - # assert_nothing_raised do - # perform_service(param: 'no_exception') - # end - def assert_nothing_raised - yield - end end end diff --git a/activesupport/lib/active_support/testing/assertions.rb b/activesupport/lib/active_support/testing/assertions.rb index 7770aa8006..6a6941c72a 100644 --- a/activesupport/lib/active_support/testing/assertions.rb +++ b/activesupport/lib/active_support/testing/assertions.rb @@ -19,6 +19,17 @@ module ActiveSupport assert !object, message end + # Assertion that the block should not raise an exception. + # + # Passes if evaluated code in the yielded block raises no exception. + # + # assert_nothing_raised do + # perform_service(param: 'no_exception') + # end + def assert_nothing_raised + yield + end + # Test numeric difference between the return value of an expression as a # result of what is evaluated in the yielded block. # -- cgit v1.2.3