diff options
author | Lucas Mazza <lucastmazza@gmail.com> | 2015-09-24 13:32:08 -0300 |
---|---|---|
committer | Lucas Mazza <lucastmazza@gmail.com> | 2015-09-24 14:17:49 -0300 |
commit | 564b162015bebe4d393ee1160f081aae8c4da1d7 (patch) | |
tree | 6cfd6e3ed20f5e6e7f655f6ddba15e2bc1cd9d08 /activesupport/test/concern_test.rb | |
parent | 44cff3045c5d98fb368e86949dd0973ee768c409 (diff) | |
download | rails-564b162015bebe4d393ee1160f081aae8c4da1d7.tar.gz rails-564b162015bebe4d393ee1160f081aae8c4da1d7.tar.bz2 rails-564b162015bebe4d393ee1160f081aae8c4da1d7.zip |
Make `assert_difference` return the result of the yielded block.
With this we can perform new assertions on the returned value without having
to cache it with an outer variable or wrapping all subsequent assertions inside
the `assert_difference` block.
Before:
```
post = nil
assert_difference -> { Post.count }, 1 do
Post.create
end
assert_predicate post, :persisted?
```
Now:
```
post = assert_difference -> { Post.count } do
Post.create
end
assert_predicate post, :persisted?
```
Diffstat (limited to 'activesupport/test/concern_test.rb')
0 files changed, 0 insertions, 0 deletions