1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activesupport/lib
Lucas Mazza 564b162015 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?
```
2015-09-24 14:17:49 -03:00
..
active_support Make assert_difference return the result of the yielded block. 2015-09-24 14:17:49 -03:00
active_support.rb Avoid to define an initializer after the load_config_initializers 2015-04-07 17:20:57 -03:00