1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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.
This commit is contained in:
Santosh Wadghule 2016-08-27 08:33:08 +05:30
parent 1ec85cf9d8
commit 3cece0b657
2 changed files with 11 additions and 11 deletions

View file

@ -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

View file

@ -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.
#