Last active
August 29, 2015 14:20
-
-
Save fotinakis/602c6bb955937681ea46 to your computer and use it in GitHub Desktop.
Pure-Rails timefreeze and flaky-ness removal for all specs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RSpec.configure do |config| | |
# Freeze time and truncate microseconds in all examples. | |
config.around(:each) do |example| | |
# Truncate microseconds to avoid test flakiness when the DB truncates microseconds | |
now_without_microseconds = Time.now.in_time_zone.change(usec: 0) | |
travel_to(now_without_microseconds) do | |
example.run | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment