-
-
Notifications
You must be signed in to change notification settings - Fork 573
Improve Availability date on annual report #5571
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
base: main
Are you sure you want to change the base?
Changes from all commits
20f4bf6
44d1cfa
07978ab
ab6799a
a94804f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| module Reports | ||
| module AnnualReportsHelper | ||
| def available_date | ||
| (Date.current + 1.year).beginning_of_year.strftime("%B%e, %Y") | ||
| end | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| RSpec.describe Reports::AnnualReportsHelper, type: :helper do | ||
| describe "#available_date" do | ||
| it "returns the first day of the following year when the current date is the first day of a given year" do | ||
| travel_to Time.zone.local(2026, 0o1, 0o1) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably should have a few edge cases here. I'd probably use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea! The original test was for January 1st, so I added coverage for Dec 31 and a date during the year in ab6799a |
||
|
|
||
| expect(helper.available_date).to eq("January 1, 2027") | ||
| end | ||
|
|
||
| it "returns the first day of the following year when the current date is the last day of a given year" do | ||
| travel_to Time.zone.local(2026, 12, 31) | ||
|
|
||
| expect(helper.available_date).to eq("January 1, 2027") | ||
| end | ||
|
|
||
| it "returns the first day of the following year" do | ||
| travel_to Time.zone.local(2026, 0o4, 15) | ||
|
|
||
| expect(helper.available_date).to eq("January 1, 2027") | ||
| end | ||
| end | ||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,14 @@ | |
| get reports_annual_reports_path(default_params) | ||
| expect(response).to have_http_status(:success) | ||
| end | ||
|
|
||
| it "displays the first day of the following year as the date when the report will be available" do | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd make this explicit, i.e. use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree! Updated this test in ab6799a. |
||
| travel_to Time.zone.local(2026, 12, 31) | ||
|
|
||
| get reports_annual_reports_path(default_params) | ||
|
|
||
| expect(response.body).to include("available on January 1, 2027") | ||
| end | ||
| end | ||
|
|
||
| describe "GET /show" do | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove the
@month_remaining_to_reportinstance variable now.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Removed it in 44d1cfa