holidays 7.1.0 → 8.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +36 -1
  3. data/README.md +3 -4
  4. data/doc/CONTRIBUTING.md +2 -1
  5. data/holidays.gemspec +5 -5
  6. data/lib/generated_definitions/MANIFEST +3 -0
  7. data/lib/generated_definitions/REGIONS.rb +2 -2
  8. data/lib/generated_definitions/ar.rb +27 -8
  9. data/lib/generated_definitions/au.rb +10 -4
  10. data/lib/generated_definitions/ca.rb +21 -16
  11. data/lib/generated_definitions/ch.rb +13 -1
  12. data/lib/generated_definitions/cl.rb +5 -5
  13. data/lib/generated_definitions/de.rb +5 -4
  14. data/lib/generated_definitions/es.rb +4 -2
  15. data/lib/generated_definitions/europe.rb +87 -24
  16. data/lib/generated_definitions/federalreservebanks.rb +1 -0
  17. data/lib/generated_definitions/gb.rb +10 -5
  18. data/lib/generated_definitions/hr.rb +8 -6
  19. data/lib/generated_definitions/hu.rb +3 -2
  20. data/lib/generated_definitions/it.rb +14 -5
  21. data/lib/generated_definitions/jp.rb +26 -21
  22. data/lib/generated_definitions/kz.rb +38 -0
  23. data/lib/generated_definitions/lu.rb +2 -0
  24. data/lib/generated_definitions/lv.rb +52 -0
  25. data/lib/generated_definitions/mx.rb +3 -3
  26. data/lib/generated_definitions/ng.rb +33 -0
  27. data/lib/generated_definitions/northamerica.rb +28 -23
  28. data/lib/generated_definitions/ro.rb +5 -2
  29. data/lib/generated_definitions/southamerica.rb +30 -11
  30. data/lib/generated_definitions/tr.rb +5 -3
  31. data/lib/generated_definitions/ua.rb +6 -6
  32. data/lib/generated_definitions/us.rb +6 -6
  33. data/lib/generated_definitions/za.rb +1 -1
  34. data/lib/holidays/definition/context/generator.rb +20 -34
  35. data/lib/holidays/definition/repository/holidays_by_month.rb +9 -1
  36. data/lib/holidays/finder/context/search.rb +34 -31
  37. data/lib/holidays/finder/rules/year_range.rb +30 -54
  38. data/lib/holidays/version.rb +1 -1
  39. data/lib/holidays.rb +2 -0
  40. data/test/coverage_report.rb +23 -5
  41. data/test/data/test_custom_year_range_holiday_defs.yaml +6 -10
  42. data/test/data/test_multiple_regions_with_conflicts_region_1.yaml +38 -0
  43. data/test/data/test_multiple_regions_with_conflicts_region_2.yaml +38 -0
  44. data/test/defs/test_defs_ar.rb +20 -4
  45. data/test/defs/test_defs_au.rb +2 -0
  46. data/test/defs/test_defs_ca.rb +41 -10
  47. data/test/defs/test_defs_ch.rb +4 -0
  48. data/test/defs/test_defs_co.rb +3 -3
  49. data/test/defs/test_defs_de.rb +2 -0
  50. data/test/defs/test_defs_es.rb +2 -0
  51. data/test/defs/test_defs_europe.rb +164 -11
  52. data/test/defs/test_defs_federalreservebanks.rb +24 -0
  53. data/test/defs/test_defs_gb.rb +24 -0
  54. data/test/defs/test_defs_hr.rb +6 -6
  55. data/test/defs/test_defs_hu.rb +12 -4
  56. data/test/defs/test_defs_it.rb +20 -0
  57. data/test/defs/test_defs_jp.rb +5 -3
  58. data/test/defs/test_defs_kz.rb +39 -0
  59. data/test/defs/test_defs_lu.rb +6 -0
  60. data/test/defs/test_defs_lv.rb +90 -0
  61. data/test/defs/test_defs_ng.rb +29 -0
  62. data/test/defs/test_defs_northamerica.rb +51 -20
  63. data/test/defs/test_defs_ro.rb +14 -0
  64. data/test/defs/test_defs_southamerica.rb +23 -7
  65. data/test/defs/test_defs_tr.rb +7 -0
  66. data/test/defs/test_defs_us.rb +10 -10
  67. data/test/holidays/core_extensions/test_date.rb +3 -2
  68. data/test/holidays/definition/context/test_generator.rb +5 -18
  69. data/test/holidays/definition/repository/test_holidays_by_month.rb +121 -1
  70. data/test/holidays/finder/rules/test_year_range.rb +43 -47
  71. data/test/integration/test_available_regions.rb +1 -1
  72. data/test/integration/test_custom_year_range_holidays.rb +0 -7
  73. data/test/integration/test_holidays.rb +3 -25
  74. data/test/integration/test_holidays_between.rb +10 -0
  75. data/test/integration/test_multiple_regions_with_conflict.rb +29 -0
  76. metadata +28 -14
@@ -41,7 +41,15 @@ module Holidays
41
41
  private
42
42
 
43
43
  def definition_exists?(existing_def, target_def)
44
- existing_def[:name] == target_def[:name] && existing_def[:wday] == target_def[:wday] && existing_def[:mday] == target_def[:mday] && existing_def[:week] == target_def[:week] && existing_def[:function] == target_def[:function] && existing_def[:type] == target_def[:type] && existing_def[:observed] == target_def[:observed] && existing_def[:year_ranges] == target_def[:year_ranges]
44
+ existing_def[:name] == target_def[:name] &&
45
+ existing_def[:wday] == target_def[:wday] &&
46
+ existing_def[:mday] == target_def[:mday] &&
47
+ existing_def[:week] == target_def[:week] &&
48
+ existing_def[:function] == target_def[:function] &&
49
+ existing_def[:function_modifier] == target_def[:function_modifier] &&
50
+ existing_def[:type] == target_def[:type] &&
51
+ existing_def[:observed] == target_def[:observed] &&
52
+ existing_def[:year_ranges] == target_def[:year_ranges]
45
53
  end
46
54
  end
47
55
  end
@@ -24,39 +24,11 @@ module Holidays
24
24
  next unless @rules[:year_range].call(year, h[:year_ranges])
25
25
  end
26
26
 
27
- current_month = month
28
- current_day = h[:mday]
29
-
30
- if h[:function]
31
- result = @custom_method_processor.call(
32
- build_custom_method_input(year, current_month, current_day, h[:regions]),
33
- h[:function], h[:function_arguments], h[:function_modifier],
34
- )
35
-
36
- #FIXME The result should always be present, see https://github.com/holidays/holidays/issues/204 for more information
37
- if result
38
- current_month = result.month
39
- current_day = result.mday
40
- else
41
- current_month = nil
42
- current_day = nil
43
- end
44
- else
45
- current_day = h[:mday] || @day_of_month_calculator.call(year, current_month, h[:week], h[:wday])
46
- end
47
-
48
- # Silently skip bad mdays
49
- #TODO Should we be doing something different here? We have no concept of logging right now. Maybe we should add it?
50
- begin
51
- date = Date.civil(year, current_month, current_day)
52
- rescue; next; end
27
+ date = build_date(year, month, h)
28
+ next unless date
53
29
 
54
30
  if observed_set?(options) && h[:observed]
55
- date = @custom_method_processor.call(
56
- build_custom_method_input(date.year, date.month, date.day, regions),
57
- h[:observed],
58
- [:date],
59
- )
31
+ date = build_observed_date(date, regions, h)
60
32
  end
61
33
 
62
34
  holidays << {:date => date, :name => h[:name], :regions => h[:regions]}
@@ -93,6 +65,29 @@ module Holidays
93
65
  options && options.include?(:observed) == true
94
66
  end
95
67
 
68
+ def build_date(year, month, h)
69
+ if h[:function]
70
+ holiday = custom_holiday(year, month, h)
71
+ #FIXME The result should always be present, see https://github.com/holidays/holidays/issues/204 for more information
72
+ current_month = holiday&.month
73
+ current_day = holiday&.mday
74
+ else
75
+ current_month = month
76
+ current_day = h[:mday] || @day_of_month_calculator.call(year, month, h[:week], h[:wday])
77
+ end
78
+
79
+ # Silently skip bad mdays
80
+ #TODO Should we be doing something different here? We have no concept of logging right now. Maybe we should add it?
81
+ Date.civil(year, current_month, current_day) rescue nil
82
+ end
83
+
84
+ def custom_holiday(year, month, h)
85
+ @custom_method_processor.call(
86
+ build_custom_method_input(year, month, h[:mday], h[:regions]),
87
+ h[:function], h[:function_arguments], h[:function_modifier],
88
+ )
89
+ end
90
+
96
91
  def build_custom_method_input(year, month, day, regions)
97
92
  {
98
93
  year: year,
@@ -101,6 +96,14 @@ module Holidays
101
96
  region: regions.first, #FIXME This isn't ideal but will work for our current use case...
102
97
  }
103
98
  end
99
+
100
+ def build_observed_date(date, regions, h)
101
+ @custom_method_processor.call(
102
+ build_custom_method_input(date.year, date.month, date.day, regions),
103
+ h[:observed],
104
+ [:date],
105
+ )
106
+ end
104
107
  end
105
108
  end
106
109
  end
@@ -1,49 +1,30 @@
1
- # Please note that only one condition needs to match in order for `call` to return `true.
2
- # See the test file for this class for specific examples.
3
1
  module Holidays
4
2
  module Finder
5
3
  module Rules
6
4
  class YearRange
7
5
  class << self
8
- BEFORE = :before
9
- AFTER = :after
6
+ UNTIL = :until
7
+ FROM = :from
10
8
  LIMITED = :limited
11
9
  BETWEEN = :between
12
10
 
13
- #TODO Can we just accept symbols here? Why accept strings?
14
- VALID_OPERATORS = [
15
- BEFORE, BEFORE.to_s,
16
- AFTER, AFTER.to_s,
17
- LIMITED, LIMITED.to_s,
18
- BETWEEN, BETWEEN.to_s
19
- ]
20
-
21
- def call(target_year, year_range_definitions)
22
- validate!(target_year, year_range_definitions)
23
-
24
- matched = false
25
- year_range_definitions.each do |range_defs|
26
- next unless range_defs.is_a?(Hash) && range_defs.length == 1
27
-
28
- operator = range_defs.keys.first
29
- year_range = range_defs.values.first
30
-
31
- case operator
32
- when BEFORE, BEFORE.to_s
33
- matched = target_year <= year_range
34
- when AFTER, AFTER.to_s
35
- matched = target_year >= year_range
36
- when LIMITED, LIMITED.to_s
37
- if year_range.is_a?(Array)
38
- matched = year_range.include?(target_year)
39
- else
40
- matched = year_range == target_year
41
- end
42
- when BETWEEN, BETWEEN.to_s
43
- matched = year_range.cover?(target_year)
44
- end
45
-
46
- break if matched == true
11
+ def call(target_year, year_range_defs)
12
+ validate!(target_year, year_range_defs)
13
+
14
+ operator = year_range_defs.keys.first
15
+ rule_value = year_range_defs[operator]
16
+
17
+ case operator
18
+ when UNTIL
19
+ matched = target_year <= rule_value
20
+ when FROM
21
+ matched = target_year >= rule_value
22
+ when LIMITED
23
+ matched = rule_value.include?(target_year)
24
+ when BETWEEN
25
+ matched = rule_value.cover?(target_year)
26
+ else
27
+ matched = false
47
28
  end
48
29
 
49
30
  matched
@@ -54,25 +35,20 @@ module Holidays
54
35
  def validate!(target_year, year_ranges)
55
36
  raise ArgumentError.new("target_year must be a number") unless target_year.is_a?(Integer)
56
37
  raise ArgumentError.new("year_ranges cannot be missing") if year_ranges.nil? || year_ranges.empty?
38
+ raise ArgumentError.new("year_ranges must contain a hash with a single operator") unless year_ranges.is_a?(Hash) && year_ranges.size == 1
57
39
 
58
- year_ranges.each do |range|
59
- raise ArgumentError.new("year_ranges must include only hashes") unless range.is_a?(Hash)
60
- raise ArgumentError.new("year_ranges cannot include empty hashes") if range.empty?
61
- raise ArgumentError.new("year_ranges entries can only include one operator") unless range.count == 1
62
-
63
- operator = range.keys.first
64
- range = range.values.first
40
+ operator = year_ranges.keys.first
41
+ value = year_ranges[operator]
65
42
 
66
- raise ArgumentError.new("Invalid operator found: '#{operator}'") unless VALID_OPERATORS.include?(operator)
43
+ raise ArgumentError.new("Invalid operator found: '#{operator}'") unless [UNTIL, FROM, LIMITED, BETWEEN].include?(operator)
67
44
 
68
- case operator
69
- when BEFORE, BEFORE.to_s, AFTER, AFTER.to_s
70
- raise ArgumentError.new(":before and :after operator value must be a number, received: '#{range}'") unless range.is_a?(Integer)
71
- when LIMITED, LIMITED.to_s
72
- raise ArgumentError.new(":limited operator value must be an array, received: '#{range}'") unless range.is_a?(Array) || range.is_a?(Integer)
73
- when BETWEEN, BETWEEN.to_s
74
- raise ArgumentError.new(":between operator value must be a range, received: '#{range}'") unless range.is_a?(Range)
75
- end
45
+ case operator
46
+ when UNTIL, FROM
47
+ raise ArgumentError.new("#{UNTIL} and #{FROM} operator value must be a number, received: '#{value}'") unless value.is_a?(Integer)
48
+ when LIMITED
49
+ raise ArgumentError.new(":limited operator value must be an array containing at least one integer value, received: '#{value}'") unless value.is_a?(Array) && value.size >= 1 && value.all? { |v| v.is_a?(Integer) }
50
+ when BETWEEN
51
+ raise ArgumentError.new(":between operator value must be a range, received: '#{value}'") unless value.is_a?(Range)
76
52
  end
77
53
  end
78
54
  end
@@ -1,3 +1,3 @@
1
1
  module Holidays
2
- VERSION = '7.1.0'
2
+ VERSION = '8.5.0'
3
3
  end
data/lib/holidays.rb CHANGED
@@ -40,6 +40,8 @@ module Holidays
40
40
 
41
41
  start_date, end_date = get_date(start_date), get_date(end_date)
42
42
 
43
+ raise ArgumentError if end_date < start_date
44
+
43
45
  if cached_holidays = Factory::Definition.cache_repository.find(start_date, end_date, options)
44
46
  return cached_holidays
45
47
  end
@@ -1,8 +1,26 @@
1
1
  require 'simplecov'
2
2
 
3
- SimpleCov.minimum_coverage 99
3
+ # For reasons I don't understand jruby implementations report lower coverage
4
+ # than other ruby versions. Ruby 2.5.3, for instance, is at 92%.
5
+ #
6
+ # We set the floor based on jruby so that all automated tests pass on Travis CI.
7
+ SimpleCov.minimum_coverage 89
8
+
9
+ SimpleCov.add_filter [
10
+ # Apparently simplecov doesn't automatically filter 'spec' or 'test' so we
11
+ # have to do it manually.
12
+ 'test',
13
+
14
+ # Only filtered because I tend to not see value in testing factories.
15
+ 'lib/holidays/factory/',
16
+
17
+ # jruby coverage flips out here and doesn't count much of the large date
18
+ # arrays used by this class. This results in an extremely low reported
19
+ # coverage for this specific file but only in jruby, not other ruby versions.
20
+ # Since it obliterates coverage percentages I'll filter it until I can come
21
+ # up with a solution.
22
+ 'lib/holidays/date_calculator/lunar_date.rb',
23
+ ]
24
+
4
25
  SimpleCov.coverage_dir 'reports/coverage'
5
- SimpleCov.start do
6
- add_filter 'lib/generated_definitions/'
7
- add_filter 'lib/holidays/factory/'
8
- end
26
+ SimpleCov.start
@@ -4,28 +4,24 @@ months:
4
4
  regions: [custom_year_range_file]
5
5
  mday: 1
6
6
  year_ranges:
7
- - after: 2016
7
+ from: 2016
8
8
  - name: before_year
9
9
  regions: [custom_year_range_file]
10
10
  mday: 2
11
11
  year_ranges:
12
- - before: 2017
12
+ until: 2017
13
13
  - name: between_year
14
14
  regions: [custom_year_range_file]
15
15
  mday: 3
16
16
  year_ranges:
17
- - between: 2016..2018
17
+ between:
18
+ start: 2016
19
+ end: 2018
18
20
  - name: limited_year
19
21
  regions: [custom_year_range_file]
20
22
  mday: 4
21
23
  year_ranges:
22
- - limited: [2016,2018,2019]
23
- - name: multiple_conditions
24
- regions: [custom_year_range_file]
25
- mday: 5
26
- year_ranges:
27
- - before: 2015
28
- - after: 2017
24
+ limited: [2016,2018,2019]
29
25
 
30
26
  tests:
31
27
  - given:
@@ -0,0 +1,38 @@
1
+ months:
2
+ 0:
3
+ - name: With Function Modifier
4
+ regions: [multiple_with_conflict_1]
5
+ function: easter(year)
6
+ function_modifier: 60
7
+ - name: With Function Only Different Function Name
8
+ regions: [multiple_with_conflict_1]
9
+ function: conflict_custom_method_1(year)
10
+ - name: With Function Only Same Function Name
11
+ regions: [multiple_with_conflict_1]
12
+ function: conflict_custom_method_identical_name_between_regions(year)
13
+ - name: With Function Only Same Function Name - Region 1
14
+ regions: [multiple_with_conflict_1]
15
+ function: conflict_custom_method_identical_name_between_regions_but_different_holiday_names(year)
16
+ 1:
17
+ - name: New Year's Day
18
+ regions: [multiple_with_conflict_1]
19
+ mday: 1
20
+ observed: to_monday_if_weekend(date)
21
+ 10:
22
+ - name: Testing Conflict Month 10
23
+ regions: [multiple_with_conflict_1]
24
+ mday: 5
25
+
26
+ methods:
27
+ conflict_custom_method_1:
28
+ arguments: year
29
+ ruby: |
30
+ Date.civil(year, 8, 1)
31
+ conflict_custom_method_identical_name_between_regions:
32
+ arguments: year
33
+ ruby: |
34
+ Date.civil(year, 9, 1)
35
+ conflict_custom_method_identical_name_between_regions_but_different_holiday_names:
36
+ arguments: year
37
+ ruby: |
38
+ Date.civil(year, 9, 15)
@@ -0,0 +1,38 @@
1
+ months:
2
+ 0:
3
+ - name: With Function Modifier
4
+ regions: [multiple_with_conflict_2]
5
+ function: easter(year)
6
+ function_modifier: 64
7
+ - name: With Function Only Different Function Name
8
+ regions: [multiple_with_conflict_2]
9
+ function: conflict_custom_method_2(year)
10
+ - name: With Function Only Same Function Name
11
+ regions: [multiple_with_conflict_2]
12
+ function: conflict_custom_method_identical_name_between_regions(year)
13
+ - name: With Function Only Same Function Name - Region 2
14
+ regions: [multiple_with_conflict_2]
15
+ function: conflict_custom_method_identical_name_between_regions_but_different_holiday_names(year)
16
+ 1:
17
+ - name: New Year's Day
18
+ regions: [multiple_with_conflict_2]
19
+ mday: 1
20
+ observed: to_tuesday_if_sunday_or_monday_if_saturday(date)
21
+ 10:
22
+ - name: Testing Conflict Month 10
23
+ regions: [multiple_with_conflict_2]
24
+ mday: 7
25
+
26
+ methods:
27
+ conflict_custom_method_2:
28
+ arguments: year
29
+ ruby: |
30
+ Date.civil(year, 12, 1)
31
+ conflict_custom_method_identical_name_between_regions:
32
+ arguments: year
33
+ ruby: |
34
+ Date.civil(year, 11, 1)
35
+ conflict_custom_method_identical_name_between_regions_but_different_holiday_names:
36
+ arguments: year
37
+ ruby: |
38
+ Date.civil(year, 11, 15)
@@ -31,21 +31,37 @@ class ArDefinitionTests < Test::Unit::TestCase # :nodoc:
31
31
 
32
32
  assert_equal "Día de la Revolución de Mayo", (Holidays.on(Date.civil(2016, 5, 25), [:ar], [:informal])[0] || {})[:name]
33
33
 
34
- assert_equal "Día de la Bandera", (Holidays.on(Date.civil(2016, 6, 20), [:ar], [:informal])[0] || {})[:name]
34
+ assert_equal "Paso a la Inmortalidad del General Martín Miguel de Güemes", (Holidays.on(Date.civil(2020, 6, 15), [:ar], [:informal])[0] || {})[:name]
35
+ assert_equal "Paso a la Inmortalidad del General Martín Miguel de Güemes", (Holidays.on(Date.civil(2021, 6, 21), [:ar], [:informal])[0] || {})[:name]
35
36
 
36
- assert_equal "Feriado puente turístico", (Holidays.on(Date.civil(2016, 7, 8), [:ar], [:informal])[0] || {})[:name]
37
+ assert_nil (Holidays.on(Date.civil(2020, 6, 17), [:ar], [:informal])[0] || {})[:name]
38
+ assert_nil (Holidays.on(Date.civil(2021, 6, 17), [:ar], [:informal])[0] || {})[:name]
39
+
40
+ assert_equal "Paso a la Inmortalidad del General Martín Miguel de Güemes", (Holidays.on(Date.civil(2016, 6, 20), [:ar], [:informal])[0] || {})[:name]
37
41
 
38
42
  assert_equal "Día de la Independencia", (Holidays.on(Date.civil(2016, 7, 9), [:ar], [:informal])[0] || {})[:name]
39
43
 
40
44
  assert_equal "Paso a la Inmortalidad del General José de San Martín", (Holidays.on(Date.civil(2016, 8, 15), [:ar], [:informal])[0] || {})[:name]
45
+ assert_equal "Paso a la Inmortalidad del General José de San Martín", (Holidays.on(Date.civil(2020, 8, 17), [:ar], [:informal])[0] || {})[:name]
46
+ assert_equal "Paso a la Inmortalidad del General José de San Martín", (Holidays.on(Date.civil(2021, 8, 16), [:ar], [:informal])[0] || {})[:name]
47
+
48
+ assert_nil (Holidays.on(Date.civil(2016, 8, 17), [:ar], [:informal])[0] || {})[:name]
49
+ assert_nil (Holidays.on(Date.civil(2021, 8, 17), [:ar], [:informal])[0] || {})[:name]
50
+
51
+ assert_equal "Día del Respeto a la Diversidad Cultural", (Holidays.on(Date.civil(2016, 10, 10), [:ar], [:informal])[0] || {})[:name]
52
+ assert_equal "Día del Respeto a la Diversidad Cultural", (Holidays.on(Date.civil(2021, 10, 11), [:ar], [:informal])[0] || {})[:name]
41
53
 
42
- assert_equal "Día del Respeto a la Diversidad Cultural", (Holidays.on(Date.civil(2016, 10, 12), [:ar], [:informal])[0] || {})[:name]
54
+ assert_nil (Holidays.on(Date.civil(2021, 10, 12), [:ar], [:informal])[0] || {})[:name]
43
55
 
44
56
  assert_equal "Día de la Soberanía Nacional", (Holidays.on(Date.civil(2016, 11, 20), [:ar], [:informal])[0] || {})[:name]
45
57
 
46
58
  assert_equal "Inmaculada Concepción de María", (Holidays.on(Date.civil(2016, 12, 8), [:ar], [:informal])[0] || {})[:name]
47
59
 
48
- assert_equal "Feriado puente turístico", (Holidays.on(Date.civil(2016, 12, 9), [:ar], [:informal])[0] || {})[:name]
60
+ assert_equal "Feriado con fines turísticos", (Holidays.on(Date.civil(2016, 7, 8), [:ar], [:informal])[0] || {})[:name]
61
+ assert_equal "Feriado con fines turísticos", (Holidays.on(Date.civil(2016, 12, 9), [:ar], [:informal])[0] || {})[:name]
62
+ assert_equal "Feriado con fines turísticos", (Holidays.on(Date.civil(2021, 5, 24), [:ar], [:informal])[0] || {})[:name]
63
+ assert_equal "Feriado con fines turísticos", (Holidays.on(Date.civil(2021, 10, 8), [:ar], [:informal])[0] || {})[:name]
64
+ assert_equal "Feriado con fines turísticos", (Holidays.on(Date.civil(2021, 11, 22), [:ar], [:informal])[0] || {})[:name]
49
65
 
50
66
  assert_equal "Navidad", (Holidays.on(Date.civil(2016, 12, 25), [:ar], [:informal])[0] || {})[:name]
51
67
 
@@ -196,5 +196,7 @@ assert_equal "Queen's Birthday", (Holidays.on(Date.civil(2016, 9, 26), [:au_wa])
196
196
 
197
197
  assert_equal "G20 Day", (Holidays.on(Date.civil(2014, 11, 14), [:au_qld_brisbane])[0] || {})[:name]
198
198
 
199
+ assert_nil (Holidays.on(Date.civil(2021, 4, 26), [:au_vic])[0] || {})[:name]
200
+
199
201
  end
200
202
  end
@@ -19,7 +19,7 @@ class CaDefinitionTests < Test::Unit::TestCase # :nodoc:
19
19
 
20
20
  assert_equal "Labour Day", (Holidays.on(Date.civil(2008, 9, 1), [:ca], [:informal])[0] || {})[:name]
21
21
 
22
- assert_equal "Christmas Day", (Holidays.on(Date.civil(2008, 12, 25), [:ca], [:informal])[0] || {})[:name]
22
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2008, 12, 25), [:ca_on], [:informal])[0] || {})[:name]
23
23
 
24
24
  assert_equal "Family Day", (Holidays.on(Date.civil(1990, 2, 19), [:ca_ab])[0] || {})[:name]
25
25
 
@@ -201,16 +201,37 @@ assert_equal "Remembrance Day", (Holidays.on(Date.civil(2017, 11, 13), [:ca_ab,
201
201
 
202
202
  assert_equal "Canada Day", (Holidays.on(Date.civil(2017, 7, 3), [:ca], [:observed])[0] || {})[:name]
203
203
 
204
- assert_equal "Christmas Day", (Holidays.on(Date.civil(2010, 12, 27), [:ca], [:observed])[0] || {})[:name]
204
+ assert_equal "National Day for Truth and Reconciliation", (Holidays.on(Date.civil(2021, 9, 30), [:ca])[0] || {})[:name]
205
205
 
206
- assert_equal "Christmas Day", (Holidays.on(Date.civil(2012, 12, 25), [:ca], [:observed])[0] || {})[:name]
206
+ assert_equal "National Day for Truth and Reconciliation", (Holidays.on(Date.civil(2026, 9, 30), [:ca])[0] || {})[:name]
207
207
 
208
- assert_equal "Christmas Day", (Holidays.on(Date.civil(2016, 12, 26), [:ca], [:observed])[0] || {})[:name]
208
+ assert_nil (Holidays.on(Date.civil(2020, 9, 30), [:ca])[0] || {})[:name]
209
209
 
210
- assert_equal "Boxing Day", (Holidays.on(Date.civil(2010, 12, 28), [:ca_on], [:observed])[0] || {})[:name]
210
+ assert_nil (Holidays.on(Date.civil(1985, 9, 30), [:ca])[0] || {})[:name]
211
+
212
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2010, 12, 25), [:ca_on])[0] || {})[:name]
213
+
214
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2018, 12, 25), [:ca_on])[0] || {})[:name]
215
+
216
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2022, 12, 25), [:ca_on])[0] || {})[:name]
217
+
218
+ assert_nil (Holidays.on(Date.civil(2022, 12, 25), [:ca], [:observed])[0] || {})[:name]
219
+
220
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2010, 12, 24), [:ca_on], [:observed])[0] || {})[:name]
221
+
222
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2012, 12, 25), [:ca_on], [:observed])[0] || {})[:name]
223
+
224
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2016, 12, 26), [:ca_on], [:observed])[0] || {})[:name]
225
+
226
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2021, 12, 24), [:ca_ab, :ca_bc, :ca_mb, :ca_nb, :ca_nl, :ca_nt, :ca_ns, :ca_nu, :ca_pe, :ca_qc, :ca_sk, :ca_yt], [:observed])[0] || {})[:name]
227
+
228
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2021, 12, 27), [:ca_on], [:observed])[0] || {})[:name]
229
+
230
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2022, 12, 26), [:ca_on], [:observed])[0] || {})[:name]
231
+
232
+ assert_equal "Boxing Day", (Holidays.on(Date.civil(2010, 12, 27), [:ca_on], [:observed])[0] || {})[:name]
211
233
  assert_equal "Boxing Day", (Holidays.on(Date.civil(2012, 12, 26), [:ca_on], [:observed])[0] || {})[:name]
212
234
  assert_equal "Boxing Day", (Holidays.on(Date.civil(2015, 12, 28), [:ca_on], [:observed])[0] || {})[:name]
213
- assert_equal "Boxing Day", (Holidays.on(Date.civil(2016, 12, 27), [:ca_on], [:observed])[0] || {})[:name]
214
235
 
215
236
  assert_nil (Holidays.on(Date.civil(2015, 6, 21), [:ca_yt])[0] || {})[:name]
216
237
 
@@ -220,13 +241,23 @@ assert_equal "Boxing Day", (Holidays.on(Date.civil(2016, 12, 27), [:ca_on], [:ob
220
241
 
221
242
  assert_equal "National Aboriginal Day", (Holidays.on(Date.civil(2018, 6, 21), [:ca_yt])[0] || {})[:name]
222
243
 
223
- assert_equal "Terry Fox Day", (Holidays.on(Date.civil(2019, 8, 5), [:ca_mb])[0] || {})[:name]
244
+ assert_equal "Terry Fox Day", (Holidays.on(Date.civil(2019, 8, 5), [:ca_mb], [:informal])[0] || {})[:name]
245
+
246
+ assert_equal "Terry Fox Day", (Holidays.on(Date.civil(2020, 8, 3), [:ca_mb], [:informal])[0] || {})[:name]
247
+
248
+ assert_nil (Holidays.on(Date.civil(2020, 8, 3), [:ca_mb])[0] || {})[:name]
249
+
250
+ assert_equal "Terry Fox Day", (Holidays.on(Date.civil(2015, 8, 3), [:ca_mb], [:informal])[0] || {})[:name]
251
+
252
+ assert_equal "Terry Fox Day", (Holidays.on(Date.civil(2045, 8, 7), [:ca_mb], [:informal])[0] || {})[:name]
253
+
254
+ assert_equal "Nunavut Day", (Holidays.on(Date.civil(2020, 7, 9), [:ca_nu])[0] || {})[:name]
224
255
 
225
- assert_equal "Terry Fox Day", (Holidays.on(Date.civil(2020, 8, 3), [:ca_mb])[0] || {})[:name]
256
+ assert_equal "Nunavut Day", (Holidays.on(Date.civil(2021, 7, 9), [:ca_nu])[0] || {})[:name]
226
257
 
227
- assert_equal "Terry Fox Day", (Holidays.on(Date.civil(2015, 8, 3), [:ca_mb])[0] || {})[:name]
258
+ assert_nil (Holidays.on(Date.civil(2019, 7, 9), [:ca_nu])[0] || {})[:name]
228
259
 
229
- assert_equal "Terry Fox Day", (Holidays.on(Date.civil(2045, 8, 7), [:ca_mb])[0] || {})[:name]
260
+ assert_nil (Holidays.on(Date.civil(2018, 7, 9), [:ca_nu])[0] || {})[:name]
230
261
 
231
262
  assert_equal "Groundhog Day", (Holidays.on(Date.civil(2013, 2, 2), [:us], [:informal])[0] || {})[:name]
232
263
 
@@ -43,5 +43,9 @@ class ChDefinitionTests < Test::Unit::TestCase # :nodoc:
43
43
 
44
44
  assert_equal "Näfelser Fahrt", (Holidays.on(Date.civil(2014, 4, 3), [:ch_gl])[0] || {})[:name]
45
45
 
46
+ assert_equal "Zibelemärit", (Holidays.on(Date.civil(2014, 11, 24), [:ch_be])[0] || {})[:name]
47
+
48
+ assert_equal "Zibelemärit", (Holidays.on(Date.civil(2020, 11, 23), [:ch_be])[0] || {})[:name]
49
+
46
50
  end
47
51
  end
@@ -45,11 +45,11 @@ class CoDefinitionTests < Test::Unit::TestCase # :nodoc:
45
45
 
46
46
  assert_equal "Día de la Ascensión", (Holidays.on(Date.civil(2017, 5, 29), [:co])[0] || {})[:name]
47
47
 
48
- assert_equal "Corpus Christi", (Holidays.on(Date.civil(2014, 6, 19), [:co])[0] || {})[:name]
48
+ assert_equal "Corpus Christi", (Holidays.on(Date.civil(2014, 6, 23), [:co])[0] || {})[:name]
49
49
 
50
- assert_equal "Corpus Christi", (Holidays.on(Date.civil(2016, 5, 26), [:co])[0] || {})[:name]
50
+ assert_equal "Corpus Christi", (Holidays.on(Date.civil(2016, 5, 30), [:co])[0] || {})[:name]
51
51
 
52
- assert_equal "Corpus Christi", (Holidays.on(Date.civil(2017, 6, 15), [:co])[0] || {})[:name]
52
+ assert_equal "Corpus Christi", (Holidays.on(Date.civil(2017, 6, 19), [:co])[0] || {})[:name]
53
53
 
54
54
  assert_equal "Sagrado Corazón", (Holidays.on(Date.civil(2014, 6, 30), [:co])[0] || {})[:name]
55
55
 
@@ -79,5 +79,7 @@ class DeDefinitionTests < Test::Unit::TestCase # :nodoc:
79
79
 
80
80
  assert_equal "Internationaler Frauentag", (Holidays.on(Date.civil(2019, 3, 8), [:de_be])[0] || {})[:name]
81
81
 
82
+ assert_equal "Tag der Befreiung", (Holidays.on(Date.civil(2020, 5, 8), [:de_be])[0] || {})[:name]
83
+
82
84
  end
83
85
  end
@@ -131,5 +131,7 @@ class EsDefinitionTests < Test::Unit::TestCase # :nodoc:
131
131
 
132
132
  assert_equal "Fiesta Nacional de Cataluña", (Holidays.on(Date.civil(2009, 9, 11), [:es_ct])[0] || {})[:name]
133
133
 
134
+ assert_equal "Lunes de Pascua Granada", (Holidays.on(Date.civil(2020, 6, 1), [:es_ct])[0] || {})[:name]
135
+
134
136
  end
135
137
  end