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

Improve specs for Time#gmtime/Time#utc #1206

Merged
merged 2 commits into from
Nov 12, 2024
Merged

Conversation

herwinw
Copy link
Member

@herwinw herwinw commented Oct 18, 2024

The Time comparison does cancel out the timezone differences, so even if you did not call the method, the spec would still pass.

@herwinw herwinw self-assigned this Oct 18, 2024
@herwinw herwinw linked an issue Oct 18, 2024 that may be closed by this pull request
@herwinw
Copy link
Member Author

herwinw commented Oct 18, 2024

Todo: validate/extend checks for Time#== (or Time#<=>)

@herwinw herwinw marked this pull request as ready for review October 25, 2024 16:17
@herwinw herwinw removed their assignment Oct 25, 2024
@herwinw
Copy link
Member Author

herwinw commented Oct 25, 2024

The second commit adds some extra checks for Time#<=>. I picked CET and BRT pretty much at random for the time zones other than UTC, I wanted something before UTC and something after UTC, and these just happened to be the ones I knew from memory.

core/time/comparison_spec.rb Show resolved Hide resolved
core/time/shared/gmtime.rb Outdated Show resolved Hide resolved
core/time/shared/gmtime.rb Outdated Show resolved Hide resolved
The Time comparison does cancel out the timezone differences, so even if
you did not call the method, the spec would still pass.
@andrykonchin andrykonchin merged commit 8e0b9e5 into ruby:master Nov 12, 2024
14 checks passed
@herwinw herwinw deleted the time_gmtime branch November 12, 2024 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Specs for Time#gmtime/Time#utc are insufficient
3 participants