Skip to content

Commit 344b285

Browse files
committed
Add helper to format an academic year
This adds a helper method which formats an academic year as a range of two years as per the design.
1 parent 662c9e4 commit 344b285

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# frozen_string_literal: true
2+
3+
module AcademicYearsHelper
4+
def format_academic_year(academic_year)
5+
"#{academic_year} to #{academic_year + 1}"
6+
end
7+
end
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# frozen_string_literal: true
2+
3+
describe AcademicYearsHelper do
4+
describe "#format_academic_year" do
5+
subject { format_academic_year(2025) }
6+
7+
it { should eq("2025 to 2026") }
8+
end
9+
end

0 commit comments

Comments
 (0)