fix: use date safely within validation window in organization spec#5535
Open
costajohnt wants to merge 1 commit intorubyforgood:mainfrom
Open
fix: use date safely within validation window in organization spec#5535costajohnt wants to merge 1 commit intorubyforgood:mainfrom
costajohnt wants to merge 1 commit intorubyforgood:mainfrom
Conversation
The test used `DateTime.current.next_year - 1.day` which is right at the boundary of the `issued_at_cannot_be_further_than_1_year` validation. This causes intermittent failures due to timing precision. Using `6.months.from_now` keeps the test intent (future date that passes validation) while staying well within the allowed window.
5 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The test at
organization_spec.rb:407usesDateTime.current.next_year - 1.dayfor theissued_atfield, which sits right at the boundary of theissued_at_cannot_be_further_than_1_yearvalidation. This causes therspec (2, 0)CI check to fail.Changed to
6.months.from_nowwhich keeps the same test intent (a future date that passes validation) while staying well within the allowed window.Test plan
rspec spec/models/organization_spec.rb:405passesrspec (2, 0)CI shard passes