From bd0451dd5265ced1a3457175f5e094c7d14aa611 Mon Sep 17 00:00:00 2001 From: eastagiletracker <310448263+eastagiletracker@users.noreply.github.com> Date: Mon, 12 Oct 2026 09:52:49 +0700 Subject: [PATCH] fix: announce Christmas Eve Christmas Eve is in HASHROCKET_HOLIDAYS, but the holidays gem does not define it for :us or :informal, so days_off never returned it and the Monday announcement skipped it. Define it in custom_holidays.yaml next to New Year's Eve and Thanksgiving Friday. --- custom_holidays.yaml | 9 +++++++++ lib/offbot/off_days.rb | 2 +- spec/offbot/off_days_spec.rb | 14 ++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/custom_holidays.yaml b/custom_holidays.yaml index b106c4a..872ea2b 100644 --- a/custom_holidays.yaml +++ b/custom_holidays.yaml @@ -5,6 +5,10 @@ months: type: :informal regions: [us] 12: + - name: Christmas Eve + regions: [us] + mday: 24 + type: :informal - name: New Year's Eve regions: [us] mday: 31 @@ -23,6 +27,11 @@ tests: regions: ["us"] expect: name: "New Year's Eve" + - given: + date: ['2017-12-24'] + regions: ["us"] + expect: + name: "Christmas Eve" - given: date: ['2017-11-24'] regions: ["us"] diff --git a/lib/offbot/off_days.rb b/lib/offbot/off_days.rb index b781056..ec64aad 100644 --- a/lib/offbot/off_days.rb +++ b/lib/offbot/off_days.rb @@ -13,7 +13,7 @@ class OffDays "Labor Day", "Thanksgiving", "Thanksgiving Friday", # in custom_holidays.yaml - "Christmas Eve", + "Christmas Eve", # in custom_holidays.yaml "Christmas Day" ].freeze diff --git a/spec/offbot/off_days_spec.rb b/spec/offbot/off_days_spec.rb index 028abb7..d7e2c6c 100644 --- a/spec/offbot/off_days_spec.rb +++ b/spec/offbot/off_days_spec.rb @@ -45,6 +45,11 @@ name: "Thanksgiving Friday", regions: array_including(:us) }, + { + date: Date.new(2017, 12, 24), + name: "Christmas Eve", + regions: array_including(:us) + }, { date: Date.new(2017, 12, 25), name: "Christmas Day", @@ -52,5 +57,14 @@ } ]) end + + it "returns Christmas Eve, which the holidays gem does not define" do + holidays = described_class.new.days_off(Date.new(2026, 12, 21), Date.new(2026, 12, 27)) + + expect(holidays.map { |holiday| [holiday[:date], holiday[:name]] }).to eq([ + [Date.new(2026, 12, 24), "Christmas Eve"], + [Date.new(2026, 12, 25), "Christmas Day"] + ]) + end end end