-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
No use database for holidays storage
- Loading branch information
Showing
7 changed files
with
34 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class Holiday | ||
def self.all | ||
new.all | ||
end | ||
|
||
def all | ||
(year2023 + year2024).map { |date| Date.parse(date) } | ||
end | ||
|
||
private | ||
|
||
def year2023 | ||
%w[2023-01-06 2023-05-01 2023-08-15 2023-10-12 2023-11-01 2023-12-06 2023-12-08 2023-12-25] | ||
end | ||
|
||
def year2024 | ||
%w[2024-01-01 2024-01-06 2024-05-01 2024-08-15 2024-10-12 2024-11-01 2024-12-06 2024-12-25] | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require "test_helper" | ||
|
||
class HolidayTest < ActiveSupport::TestCase | ||
test "2022-11-22 is not holiday" do | ||
assert_not Holiday.all.include?(Date.parse("2022-11-22")) | ||
end | ||
|
||
test "2023-01-06 is holiday" do | ||
assert_includes Holiday.all, Date.parse("2023-01-06") | ||
end | ||
|
||
test "2024-01-01 is holiday" do | ||
assert_includes Holiday.all, Date.parse("2024-01-01") | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.