Skip to content

Add named params and yard docs to create_milestone method at GithubHelper #426

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

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions spec/github_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ def get_milestone(milestone_name:)
it 'computes the correct dates when the due date is on the verge of a DST day change' do
# Europe DST starts on the last Sunday of March, and ends on the last Sunday of October
Time.use_zone('Europe/London') do
# March 27th, 2022 is the exact day that London switches to the DST (+1h)
# If the due date is too close to the next day, a day change will happen
# So, 2022-03-27 23:00:00Z will be exactly 2022-03-28 00:00:00 +0100 at the DST change
Comment on lines +245 to +247
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

due_date = Time.zone.parse('2022-03-27 23:00:00Z')
options = {
due_on: '2022-03-28T12:00:00Z',
Expand All @@ -256,6 +259,25 @@ def get_milestone(milestone_name:)
it 'computes the correct dates when the due date is on DST but has no day change' do
# Europe DST starts on the last Sunday of March, and ends on the last Sunday of October
Time.use_zone('Europe/London') do
# March 27th, 2022 is the exact day that London switches to the DST (+1h)
# If the due date is not close enough at the day change, nothing will occur.
# So, 2022-03-27 22:00:00Z will be exactly 2022-03-27 23:00:00 +0100 at the DST change.
due_date = Time.zone.parse('2022-03-27 22:00:00Z')
options = {
due_on: '2022-03-27T12:00:00Z',
description: "Code freeze: March 27, 2022\nApp Store submission: March 29, 2022\nRelease: March 30, 2022\n"
}

expect(client).to receive(:create_milestone).with(test_repo, test_milestone_number, options)
create_milestone(due_date: due_date, days_until_submission: 2, days_until_release: 3)
end
end

it 'computes the correct dates when the due date is one day before a DST change' do
# Europe DST starts on the last Sunday of March, and ends on the last Sunday of October
Time.use_zone('Europe/London') do
# As London changes to DST on March 27th, the date shouldn't be changed
# So, 2022-03-26 23:00:00Z will be exactly 2022-03-26 23:00:00 +0000 at this Timezone.
due_date = Time.zone.parse('2022-03-26 23:00:00Z')
options = {
due_on: '2022-03-26T12:00:00Z',
Expand Down