Skip to content

Commit ab6799a

Browse files
Better test setup and scenarios
1 parent 07978ab commit ab6799a

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
RSpec.describe Reports::AnnualReportsHelper, type: :helper do
22
describe "#available_date" do
3-
it "returns the first day of the following year with a custom date format" do
3+
it "returns the first day of the following year when the current date is the first day of a given year" do
44
travel_to Time.zone.local(2026, 0o1, 0o1)
55

66
expect(helper.available_date).to eq("January 1, 2027")
77
end
8+
9+
it "returns the first day of the following year when the current date is the last day of a given year" do
10+
travel_to Time.zone.local(2026, 12, 31)
11+
12+
expect(helper.available_date).to eq("January 1, 2027")
13+
end
14+
15+
it "returns the first day of the following year" do
16+
travel_to Time.zone.local(2026, 0o4, 15)
17+
18+
expect(helper.available_date).to eq("January 1, 2027")
19+
end
820
end
921
end

spec/requests/reports/annual_reports_requests_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@
1919
end
2020

2121
it "displays the first day of the following year as the date when the report will be available" do
22+
travel_to Time.zone.local(2026, 12, 31)
23+
2224
get reports_annual_reports_path(default_params)
2325

24-
expect(response.body).to include("available in #{(Date.current + 1.year).beginning_of_year.strftime("%B%e, %Y")}")
26+
expect(response.body).to include("available on January 1, 2027")
2527
end
2628
end
2729

0 commit comments

Comments
 (0)