Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add methods to allow Timecop instance checking if in a travelled or scaled state #414

Conversation

djgraham
Copy link
Contributor

In a recent Timecop release (0.9.7, commit c57a1fc), a fix was made to the boolean method#frozen? which previously returned true if Timecop was active at that instance in time (frozen, scaled or travelled). This method was changed so that only returned true if Timecop was in a frozen state. Once this change was made it was no longer possible to check if Timecop was in a scaled or travelled state.

As a result of this change, our automated test suite, which relied on the previous behaviour of frozen? failed (we used it to check if Timecop present in any way in a database helper, and it affected how our automated factory objects were being created where dates are involved). We discovered this after investigating a dependabot automated gem update failure.

This PR exposes two additional methods scaled? and travelled? to allow a consumer to check for these states. I did consider an alternative method active? which would have been the previous frozen? behaviour, but decided to be explicit in these new methods.

I've added in some additional tests to cover what I think are most of the examples.

(Note: will update changelog if this PR is likely to get merged)

Thank you

Copy link
Collaborator

@joshuacronemeyer joshuacronemeyer left a comment

Choose a reason for hiding this comment

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

@djgraham this makes sense to me and looks good.

@joshuacronemeyer
Copy link
Collaborator

@djgraham update changelog request will be accepted. We can plan for this to be the first timecop release of 2024. 2024 is a leap year so looking forward to a lot of fun for tests and testing in this exciting future we're living through!

;p

@djgraham
Copy link
Contributor Author

Thank you for the PR approval @joshuacronemeyer ! I've added in an additional commit to for the entry to History.md

Hopefully if these are all good they can be merged in 🤞

Thanks again !

@joshuacronemeyer joshuacronemeyer merged commit b598852 into travisjeffery:master Dec 29, 2023
11 checks passed
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.

2 participants