Use Time.zone.now in factories
If you do any timezone-sensitive calculations in your Rails application and you use Factory Girl and Timecop, make sure you don't set any datetime values using Time.now, but rather Time.zone.now. Otherwise you may end up with code that works on one machine but fails on another due to time zone setting difference.
Written by Norman Clarke
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#