Skip to content

fix: use date safely within validation window in organization spec#5535

Open
costajohnt wants to merge 1 commit intorubyforgood:mainfrom
costajohnt:fix/organization-spec-date
Open

fix: use date safely within validation window in organization spec#5535
costajohnt wants to merge 1 commit intorubyforgood:mainfrom
costajohnt:fix/organization-spec-date

Conversation

@costajohnt
Copy link
Copy Markdown

Summary

The test at organization_spec.rb:407 uses DateTime.current.next_year - 1.day for the issued_at field, which sits right at the boundary of the issued_at_cannot_be_further_than_1_year validation. This causes the rspec (2, 0) CI check to fail.

Changed to 6.months.from_now which 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:405 passes
  • Full rspec (2, 0) CI shard passes

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.
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.

1 participant