This blog is part of our Rails 5.1 series.
Rails 5.1 has introduced
It can be seen as a more generic version of
assert_changes asserts the value of an expression is changed
before and after invoking the block.
The specified expression can be string like
We can also pass a lambda as an expression.
assert_changes also allows options
to specify initial and final state of expression.
We can also specify test failure message.
assert_no_changes has same options
asserts that the expression doesn’t change
after invoking the block.