1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot.git synced 2022-11-09 11:43:51 -05:00
thoughtbot--factory_bot/lib/factory_bot/strategy
Daniel Colson f56394c187 Set timestamps before clearing changes
e7f66fb2 fixed one problem and introduced a new one. Setting timestamps
after clearing_changes_information doesn't work, since using the
created_at and updated_at setters will change the object again. I added
some additional specs for this case (our only spec related to clearing
changes used an object without timestamps).

For the timezone problem, I did a little digging and realized the
casting behavior was actually correct. The reason it was behaving in a
different way than I was expecting is because we had
`time_zone_aware_attributes` set to false, whereas the AR railtie
[sets it to true](54652d886a/activerecord/lib/active_record/railtie.rb (L71)). Setting it to true causes date and datetime attributes
[to get decorated with a TimeZoneConverter](54652d886a/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb (L68..L87))
2018-11-12 17:35:05 -05:00
..
attributes_for.rb Replace 'girl' with 'bot' everywhere (#1051) 2017-10-20 15:20:28 -04:00
build.rb Replace 'girl' with 'bot' everywhere (#1051) 2017-10-20 15:20:28 -04:00
create.rb Replace 'girl' with 'bot' everywhere (#1051) 2017-10-20 15:20:28 -04:00
null.rb [Rubocop] Style Cop Offenses (#1208) 2018-10-07 18:02:54 -04:00
stub.rb Set timestamps before clearing changes 2018-11-12 17:35:05 -05:00