diff options
author | Zachary Scott <e@zzak.io> | 2015-05-23 23:34:42 -0700 |
---|---|---|
committer | Zachary Scott <e@zzak.io> | 2015-05-23 23:34:42 -0700 |
commit | d6f59eac657920600fc24fba799e46776e77550f (patch) | |
tree | d851a952724a99f5b7670b7899aefa05b39cf5f1 /activesupport | |
parent | 281581f76fa1c4ed509bfc7e86f7a1be4bd3d6a8 (diff) | |
parent | aa8672a5ba3af7f9b440bc58dc63ed8aa2b586c0 (diff) | |
download | rails-d6f59eac657920600fc24fba799e46776e77550f.tar.gz rails-d6f59eac657920600fc24fba799e46776e77550f.tar.bz2 rails-d6f59eac657920600fc24fba799e46776e77550f.zip |
Merge pull request #20279 from y-yagi/assert_difference_example
use keyword arguments in HTTP request methods of assert_difference example [ci skip]
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/testing/assertions.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/activesupport/lib/active_support/testing/assertions.rb b/activesupport/lib/active_support/testing/assertions.rb index 8b649c193f..411dd29df5 100644 --- a/activesupport/lib/active_support/testing/assertions.rb +++ b/activesupport/lib/active_support/testing/assertions.rb @@ -23,42 +23,42 @@ module ActiveSupport # result of what is evaluated in the yielded block. # # assert_difference 'Article.count' do - # post :create, article: {...} + # post :create, params: { article: {...} } # end # # An arbitrary expression is passed in and evaluated. # # assert_difference 'assigns(:article).comments(:reload).size' do - # post :create, comment: {...} + # post :create, params: { comment: {...} } # end # # An arbitrary positive or negative difference can be specified. # The default is <tt>1</tt>. # # assert_difference 'Article.count', -1 do - # post :delete, id: ... + # post :delete, params: { id: ... } # end # # An array of expressions can also be passed in and evaluated. # # assert_difference [ 'Article.count', 'Post.count' ], 2 do - # post :create, article: {...} + # post :create, params: { article: {...} } # end # # A lambda or a list of lambdas can be passed in and evaluated: # # assert_difference ->{ Article.count }, 2 do - # post :create, article: {...} + # post :create, params: { article: {...} } # end # # assert_difference [->{ Article.count }, ->{ Post.count }], 2 do - # post :create, article: {...} + # post :create, params: { article: {...} } # end # # An error message can be specified. # # assert_difference 'Article.count', -1, 'An Article should be destroyed' do - # post :delete, id: ... + # post :delete, params: { id: ... } # end def assert_difference(expression, difference = 1, message = nil, &block) expressions = Array(expression) @@ -81,13 +81,13 @@ module ActiveSupport # changed before and after invoking the passed in block. # # assert_no_difference 'Article.count' do - # post :create, article: invalid_attributes + # 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, article: invalid_attributes + # post :create, params: { article: invalid_attributes } # end def assert_no_difference(expression, message = nil, &block) assert_difference expression, 0, message, &block |