redding/mr — pull request #163 by jcredding (2014-01-08 18:00:43+00:00)
Title: Have `FakeRecord` use active record's default timezone for timestamps

This updates how `FakeRecord` sets timestamps to better mimic
how ActiveRecord handles it. It will now look at the
`default_timezone` configured for ActiveRecord and use that to
either build a local time or a utc time. This is what ActiveRecord
itself does.

This fixes issues with the time zones not matching up between
the timestamps `FakeRecord` set and time/datetime values generated
by `MR::Factory`. Since `MR::Factory` uses ActiveRecord to typecast
datetime values, it was already using ActiveRecord's
`default_timezone`. Prevously, `FakeRecord` was always using
`Time.now` (which is always local time) which would lead to
mismatched time zones if the `default_timezone` was set to UTC.

This fixes #158 by ensuring both sides using ActiveRecord's
`default_timezone`. The proposed solution of #158 doesn't
actually work as ActiveRecord doesn't honor the time zone in a
datetime string. This is because ActiveRecord's typecasting
expects the values to be coming from a DB that it has managed.
Thus it handles writing them using the `default_timezone` and
expects to read them as if they used the `default_timezone`.
This makes sense because many DBs don't even support a timezone
for datetime values.

Closes #158