diff options
author | lxxxvi <lxxxvi@users.noreply.github.com> | 2018-07-08 15:15:16 +0200 |
---|---|---|
committer | lxxxvi <lxxxvi@users.noreply.github.com> | 2018-07-08 15:15:16 +0200 |
commit | 4baad7bec63e5d842e36d9d25c1203900a499f67 (patch) | |
tree | 1cbcc514207ca060a769d9150d6c1143500f2767 /activesupport/lib | |
parent | 1d97b8f9e4ef0bbac093210c1e245c377ea30486 (diff) | |
download | rails-4baad7bec63e5d842e36d9d25c1203900a499f67.tar.gz rails-4baad7bec63e5d842e36d9d25c1203900a499f67.tar.bz2 rails-4baad7bec63e5d842e36d9d25c1203900a499f67.zip |
added tests for assert_no_difference with multiple expressions
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/testing/assertions.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/testing/assertions.rb b/activesupport/lib/active_support/testing/assertions.rb index 6a56da384f..b27ac7ce99 100644 --- a/activesupport/lib/active_support/testing/assertions.rb +++ b/activesupport/lib/active_support/testing/assertions.rb @@ -113,11 +113,23 @@ module ActiveSupport # post :create, params: { article: invalid_attributes } # end # + # A lambda can be passed in and evaluated. + # + # assert_no_difference -> { Article.count } do + # post :create, params: { article: invalid_attributes } + # end + # # An error message can be specified. # # assert_no_difference 'Article.count', 'An Article should not be created' do # post :create, params: { article: invalid_attributes } # end + # + # An array of expressions can also be passed in and evaluated. + # + # assert_no_difference [ 'Article.count', -> { Post.count } ] do + # post :create, params: { article: invalid_attributes } + # end def assert_no_difference(expression, message = nil, &block) assert_difference expression, 0, message, &block end |