Skip to content

Replace Timecop with ActiveSupport::Testing::TimeHelpers#5320

Merged
mitchellhenke merged 3 commits intomainfrom
mitchellhenke/timecop
Aug 24, 2021
Merged

Replace Timecop with ActiveSupport::Testing::TimeHelpers#5320
mitchellhenke merged 3 commits intomainfrom
mitchellhenke/timecop

Conversation

@mitchellhenke
Copy link
Copy Markdown
Contributor

@mitchellhenke mitchellhenke commented Aug 23, 2021

Replaces Timecop with ActiveSupport's very similar TimeHelpers. There were also some issues with Timecop in #5301.

This PR also removes time travel travel from some specs where it seemed unnecessary.

Co-authored-by: Andrew Duthie <andrew.duthie@gsa.gov>
@mitchellhenke mitchellhenke force-pushed the mitchellhenke/timecop branch 3 times, most recently from f30fe7d to 1f8d638 Compare August 23, 2021 21:06
@mitchellhenke mitchellhenke force-pushed the mitchellhenke/timecop branch from 1f8d638 to 86a8f8a Compare August 23, 2021 21:10
@mitchellhenke mitchellhenke marked this pull request as ready for review August 23, 2021 21:21
)

Timecop.travel(Time.zone.now + idv_send_link_attempt_window_in_minutes.minutes) do
travel_to(Time.zone.now + idv_send_link_attempt_window_in_minutes.minutes + 1) do
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specs like these where time travel is going to the beginning of a window would intermittently fail because it hadn't traveled far enough in time.

I'm not sure if it's due to partial seconds, a delay in Timecop, or something else, but the tests reliably pass by adding a second.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷

Copy link
Copy Markdown
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mitchellhenke mitchellhenke merged commit 27da081 into main Aug 24, 2021
@mitchellhenke mitchellhenke deleted the mitchellhenke/timecop branch August 24, 2021 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants