redding/mr — pull request #170 by jcredding (2014-01-27 16:44:33+00:00)
Title: `FakeRecord`, no longer track attribute changes, simplify test helpers

This is a simplification to `FakeRecord` and MR's `TestHelpers`.
`FakeRecord` no longer tracks attriute changes when its saved.
Now it uses a simple boolean flag, `save_called`, to track if
the `save!` method was called. Not tracking changes simplifies
the `assert_field_saved` test helper. It no longer checks that
the value changed, only that it exists in the saved attributes
and the expected value matches. The test helpers now provide a
new assertion, `assert_model_saved` that will check the new
boolean flag `save_called`. These can be combined to detect that
a fake record was saved and that it was saved with the correct
values.

This also includes the following related changes:
* `FakeRecord` has a method `reset_save_called` which sets the
`save_called` boolean to `false`. This can be used to manually
reset a fake record. More importantly though, it will be used
by factories and stacks to reset the 'state' of a fake record
after they are done with it. This will be done in a separate
commit.
* `assert_association_saved` and `assert_field_saved` now always
take an expected value. This is to simplify the test helpers
and is so they can always check that what was saved was what
was expected.
* Renamed `assert_destroyed` to `assert_model_destroyed`. This
fits the overall naming scheme better (`assert_field`,
`assert_association`) and is more explicit. I also didn't like
`assert_saved` for the new test helper, it didn't indicate it
should be used with `MR` models, but I wanted it and the
destroyed test helper to be simple. Thus, the rename.