holidays 5.1.0 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 77b3290ef77ac73e4c81a51e2d74b2b68ef60533
4
- data.tar.gz: f72a5fde80cdbfd9162900fd3d136a19021ae813
3
+ metadata.gz: b6d31623329597545a952074f25ebce282d0fe5e
4
+ data.tar.gz: aeac59f19f9daf945edcf3570edbfe655a582c75
5
5
  SHA512:
6
- metadata.gz: e31642097c28e4b700ec95fe24ee45130df17293024068bddd78f574501b65dced6c5dc54c86eb53c27ecd4e5eff802830b6db216f51443fbcd34ac1813fe2c5
7
- data.tar.gz: e8277aacc33b835caa5b7404f9e348ac5533355fb99113b596a20081c0a64714c677a30ce478ab156cb2b58e92fc5d63c26d042a080132baffdeb9318405c818
6
+ metadata.gz: 7dbddcad5a4c32ec56bd0dee354fe6323752c8205f147a6b935d9723050eb590df5c15c18caaea97ec812617f850b181581046c5d06882552b969d51458b6588
7
+ data.tar.gz: 73ada22bfbca45a7adafa80ecbaeb44ba9c330b6eab55b6edbe5ccaadaee9ef0edf351834e23bf7cf3f5d4caebd716299348f917275db01b0431ddea79968f74
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Ruby Holidays Gem CHANGELOG
2
2
 
3
+ ## 5.2.0
4
+
5
+ * Point to latest (v1.2.0 of definitions)
6
+ ** updates `jp` defs to fix 'Foundation Day' name
7
+ ** Fix `ca` defs for observed holidays
8
+ ** Update `au` defs to have Christmas and Boxing Day for all of Australia instead of just individual territories
9
+ ** Update `ie` defs to consolidate St Stephen's Day to use common method instead of custom method
10
+
3
11
  ## 5.1.0
4
12
 
5
13
  * Add `load_all` method to `Holidays` namespace to preload all definitions (i.e. no lazy loading)
data/README.md CHANGED
@@ -153,14 +153,6 @@ Or find end of month for given date (requires 'Time' extensions as well):
153
153
  d.end_of_month
154
154
  => #<Date: 2016-08-31 ((2457632j,0s,0n),+0s,2299161j)>
155
155
 
156
- ### Caching Holiday Lookups
157
-
158
- If you are checking holidays regularly you can cache your results for improved performance. Run this before looking up a holiday (eg. in an initializer):
159
-
160
- Holidays.cache_between(Time.now, 2.years.from_now, :ca, :us, :observed)
161
-
162
- Holidays for the regions specified within the dates specified will be pre-calculated and stored in-memory. Future lookups will be much faster.
163
-
164
156
  ### How to contribute
165
157
 
166
158
  See our [contribution guidelines](CONTRIBUTING.md) for information on how to help out!
@@ -51,10 +51,10 @@ module Holidays
51
51
  11 => [{:function => "g20_day_2014_only(year)", :function_arguments => [:year], :name => "G20 Day", :regions => [:au_qld_brisbane]},
52
52
  {:wday => 1, :week => 1, :name => "Recreation Day", :regions => [:au_tas_north]},
53
53
  {:wday => 2, :week => 1, :name => "Melbourne Cup Day", :regions => [:au_vic_melbourne]}],
54
- 12 => [{:mday => 25, :observed => "to_tuesday_if_sunday_or_monday_if_saturday(date)", :observed_arguments => [:date], :name => "Christmas Day", :regions => [:au_qld, :au_nsw, :au_act, :au_tas, :au_wa]},
54
+ 12 => [{:mday => 25, :observed => "to_tuesday_if_sunday_or_monday_if_saturday(date)", :observed_arguments => [:date], :name => "Christmas Day", :regions => [:au, :au_qld, :au_nsw, :au_act, :au_tas, :au_wa]},
55
55
  {:mday => 25, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Christmas Day", :regions => [:au_sa]},
56
56
  {:function => "xmas_to_weekday_if_weekend(year)", :function_arguments => [:year], :name => "Christmas Day", :regions => [:au_vic, :au_nt]},
57
- {:mday => 26, :observed => "to_tuesday_if_sunday_or_monday_if_saturday(date)", :observed_arguments => [:date], :name => "Boxing Day", :regions => [:au_nsw, :au_vic, :au_qld, :au_act, :au_wa]},
57
+ {:mday => 26, :observed => "to_tuesday_if_sunday_or_monday_if_saturday(date)", :observed_arguments => [:date], :name => "Boxing Day", :regions => [:au, :au_nsw, :au_vic, :au_qld, :au_act, :au_wa]},
58
58
  {:function => "to_weekday_if_boxing_weekend_from_year_or_to_tuesday_if_monday(year)", :function_arguments => [:year], :name => "Boxing Day", :regions => [:au_sa]},
59
59
  {:function => "to_weekday_if_boxing_weekend_from_year(year)", :function_arguments => [:year], :name => "Boxing Day", :regions => [:au_tas, :au_nt]}]
60
60
  }
@@ -21,7 +21,7 @@ module Holidays
21
21
  0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Good Friday", :regions => [:ca]},
22
22
  {:function => "easter(year)", :function_arguments => [:year], :name => "Easter Sunday", :regions => [:ca]},
23
23
  {:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :type => :informal, :name => "Easter Monday", :regions => [:ca]}],
24
- 1 => [{:mday => 1, :name => "New Year's Day", :regions => [:ca]},
24
+ 1 => [{:mday => 1, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "New Year's Day", :regions => [:ca]},
25
25
  {:mday => 2, :name => "New Year's", :regions => [:ca_qc]}],
26
26
  2 => [{:wday => 1, :week => 3, :year_ranges => [{:after => 1990}],:name => "Family Day", :regions => [:ca_ab]},
27
27
  {:wday => 1, :week => 3, :year_ranges => [{:after => 2007}],:name => "Family Day", :regions => [:ca_sk]},
@@ -42,7 +42,7 @@ module Holidays
42
42
  {:mday => 24, :name => "Fête Nationale", :regions => [:ca_qc]},
43
43
  {:mday => 21, :name => "National Aboriginal Day", :regions => [:ca_nt]},
44
44
  {:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
45
- 7 => [{:mday => 1, :observed => "to_monday_if_sunday(date)", :observed_arguments => [:date], :name => "Canada Day", :regions => [:ca]},
45
+ 7 => [{:mday => 1, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Canada Day", :regions => [:ca]},
46
46
  {:mday => 12, :name => "Orangemen's Day", :regions => [:ca_nf]},
47
47
  {:mday => 9, :name => "Nunavut Day", :regions => [:ca_nu]}],
48
48
  8 => [{:wday => 1, :week => 1, :name => "BC Day", :regions => [:ca_bc]},
@@ -55,9 +55,9 @@ module Holidays
55
55
  9 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:ca]}],
56
56
  10 => [{:wday => 1, :week => 2, :name => "Thanksgiving", :regions => [:ca]},
57
57
  {:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}],
58
- 11 => [{:mday => 11, :name => "Remembrance Day", :regions => [:ca_ab, :ca_sk, :ca_bc, :ca_pe, :ca_nf, :ca_nt, :ca_nu, :ca_nb, :ca_yk]}],
59
- 12 => [{:mday => 25, :name => "Christmas Day", :regions => [:ca]},
60
- {:mday => 26, :name => "Boxing Day", :regions => [:ca]}],
58
+ 11 => [{:mday => 11, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Remembrance Day", :regions => [:ca_ab, :ca_sk, :ca_bc, :ca_pe, :ca_nf, :ca_nt, :ca_nu, :ca_nb, :ca_yk]}],
59
+ 12 => [{:mday => 25, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Christmas Day", :regions => [:ca]},
60
+ {:mday => 26, :observed => "to_weekday_if_boxing_weekend(date)", :observed_arguments => [:date], :name => "Boxing Day", :regions => [:ca]}],
61
61
  4 => [{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
62
62
  {:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}]
63
63
  }
@@ -351,7 +351,7 @@ module Holidays
351
351
  {:mday => 25, :name => "Karácsony", :regions => [:hu]},
352
352
  {:mday => 26, :name => "Karácsony", :regions => [:hu]},
353
353
  {:mday => 25, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Christmas Day", :regions => [:ie]},
354
- {:mday => 26, :observed => "ie_st_stephens_day(date)", :observed_arguments => [:date], :name => "St. Stephen's Day", :regions => [:ie]},
354
+ {:mday => 26, :observed => "to_weekday_if_boxing_weekend(date)", :observed_arguments => [:date], :name => "St. Stephen's Day", :regions => [:ie]},
355
355
  {:mday => 24, :name => "Jól", :regions => [:is]},
356
356
  {:mday => 25, :name => "Jól", :regions => [:is]},
357
357
  {:mday => 26, :name => "Jól", :regions => [:is]},
@@ -523,14 +523,6 @@ end
523
523
  date
524
524
  },
525
525
 
526
- "ie_st_stephens_day(date)" => Proc.new { |date|
527
- case date.wday
528
- when 6, 0 then date + 2
529
- when 1 then date + 1
530
- else date
531
- end
532
- },
533
-
534
526
  "is_sumardagurinn_fyrsti(year)" => Proc.new { |year|
535
527
  date = Date.civil(year,4,18)
536
528
  if date.wday < 4
@@ -26,21 +26,13 @@ module Holidays
26
26
  8 => [{:wday => 1, :week => 1, :name => "August Bank Holiday", :regions => [:ie]}],
27
27
  10 => [{:wday => 1, :week => -1, :name => "October Bank Holiday", :regions => [:ie]}],
28
28
  12 => [{:mday => 25, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Christmas Day", :regions => [:ie]},
29
- {:mday => 26, :observed => "ie_st_stephens_day(date)", :observed_arguments => [:date], :name => "St. Stephen's Day", :regions => [:ie]}]
29
+ {:mday => 26, :observed => "to_weekday_if_boxing_weekend(date)", :observed_arguments => [:date], :name => "St. Stephen's Day", :regions => [:ie]}]
30
30
  }
31
31
  end
32
32
 
33
33
  def self.custom_methods
34
34
  {
35
- "ie_st_stephens_day(date)" => Proc.new { |date|
36
- case date.wday
37
- when 6, 0 then date + 2
38
- when 1 then date + 1
39
- else date
40
- end
41
- },
42
-
43
-
35
+
44
36
  }
45
37
  end
46
38
  end
@@ -21,7 +21,7 @@ module Holidays
21
21
  1 => [{:mday => 1, :name => "元日", :regions => [:jp]},
22
22
  {:wday => 1, :week => 2, :name => "成人の日", :regions => [:jp]},
23
23
  {:mday => 1, :function => "jp_substitute_holiday(year, month, day)", :function_arguments => [:year, :month, :day], :name => "振替休日", :regions => [:jp]}],
24
- 2 => [{:mday => 11, :name => "建国記念日", :regions => [:jp]},
24
+ 2 => [{:mday => 11, :name => "建国記念の日", :regions => [:jp]},
25
25
  {:mday => 11, :function => "jp_substitute_holiday(year, month, day)", :function_arguments => [:year, :month, :day], :name => "振替休日", :regions => [:jp]}],
26
26
  3 => [{:function => "jp_vernal_equinox_day(year)", :function_arguments => [:year], :name => "春分の日", :regions => [:jp]},
27
27
  {:function => "jp_vernal_equinox_day_substitute(year)", :function_arguments => [:year], :name => "振替休日", :regions => [:jp]}],
@@ -23,7 +23,7 @@ module Holidays
23
23
  {:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :type => :informal, :name => "Easter Monday", :regions => [:ca]},
24
24
  {:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :type => :informal, :name => "Good Friday", :regions => [:us]},
25
25
  {:function => "easter(year)", :function_arguments => [:year], :type => :informal, :name => "Easter Sunday", :regions => [:us]}],
26
- 1 => [{:mday => 1, :name => "New Year's Day", :regions => [:ca]},
26
+ 1 => [{:mday => 1, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "New Year's Day", :regions => [:ca]},
27
27
  {:mday => 2, :name => "New Year's", :regions => [:ca_qc]},
28
28
  {:mday => 1, :name => "Año nuevo", :regions => [:mx]},
29
29
  {:mday => 6, :name => "Dia de los Santos Reyes", :regions => [:mx]},
@@ -60,7 +60,7 @@ module Holidays
60
60
  {:mday => 21, :name => "National Aboriginal Day", :regions => [:ca_nt]},
61
61
  {:wday => 0, :week => 3, :type => :informal, :name => "Día del Padre", :regions => [:mx]},
62
62
  {:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
63
- 7 => [{:mday => 1, :observed => "to_monday_if_sunday(date)", :observed_arguments => [:date], :name => "Canada Day", :regions => [:ca]},
63
+ 7 => [{:mday => 1, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Canada Day", :regions => [:ca]},
64
64
  {:mday => 12, :name => "Orangemen's Day", :regions => [:ca_nf]},
65
65
  {:mday => 9, :name => "Nunavut Day", :regions => [:ca_nu]},
66
66
  {:mday => 4, :observed => "to_weekday_if_weekend(date)", :observed_arguments => [:date], :name => "Independence Day", :regions => [:us]}],
@@ -79,15 +79,15 @@ module Holidays
79
79
  {:mday => 12, :type => :informal, :name => "Día de la Raza", :regions => [:mx]},
80
80
  {:wday => 1, :week => 2, :name => "Columbus Day", :regions => [:us]},
81
81
  {:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}],
82
- 11 => [{:mday => 11, :name => "Remembrance Day", :regions => [:ca_ab, :ca_sk, :ca_bc, :ca_pe, :ca_nf, :ca_nt, :ca_nu, :ca_nb, :ca_yk]},
82
+ 11 => [{:mday => 11, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Remembrance Day", :regions => [:ca_ab, :ca_sk, :ca_bc, :ca_pe, :ca_nf, :ca_nt, :ca_nu, :ca_nb, :ca_yk]},
83
83
  {:mday => 1, :type => :informal, :name => "Todos los Santos", :regions => [:mx]},
84
84
  {:mday => 2, :type => :informal, :name => "Los Fieles Difuntos", :regions => [:mx]},
85
85
  {:wday => 1, :week => 3, :name => "Día de la Revolución", :regions => [:mx]},
86
86
  {:mday => 11, :observed => "to_weekday_if_weekend(date)", :observed_arguments => [:date], :name => "Veterans Day", :regions => [:us]},
87
87
  {:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:us]},
88
88
  {:function => "day_after_thanksgiving(year)", :function_arguments => [:year], :name => "Day after Thanksgiving", :regions => [:us_ca]}],
89
- 12 => [{:mday => 25, :name => "Christmas Day", :regions => [:ca]},
90
- {:mday => 26, :name => "Boxing Day", :regions => [:ca]},
89
+ 12 => [{:mday => 25, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Christmas Day", :regions => [:ca]},
90
+ {:mday => 26, :observed => "to_weekday_if_boxing_weekend(date)", :observed_arguments => [:date], :name => "Boxing Day", :regions => [:ca]},
91
91
  {:mday => 12, :type => :informal, :name => "Día de la Virgen de Guadalupe", :regions => [:mx]},
92
92
  {:mday => 24, :type => :informal, :name => "Nochebuena", :regions => [:mx]},
93
93
  {:mday => 25, :name => "Navidad", :regions => [:mx]},
@@ -1,3 +1,3 @@
1
1
  module Holidays
2
- VERSION = '5.1.0'
2
+ VERSION = '5.2.0'
3
3
  end
@@ -92,15 +92,14 @@ assert_equal [], Date.civil(2015, 4, 27).holidays(:au_qld, :observed)
92
92
  assert_equal "ANZAC Day", Date.civil(2015, 4, 27).holidays(:au_wa, :observed)[0][:name]
93
93
 
94
94
  # BOXING DAY - QLD observes weekend and monday
95
+ assert_equal "Boxing Day", Date.civil(2015, 12, 26).holidays(:au)[0][:name]
96
+ assert_equal "Boxing Day", Date.civil(2015, 12, 28).holidays(:au, :observed)[0][:name]
95
97
  assert_equal "Boxing Day", Date.civil(2015, 12, 26).holidays(:au_qld)[0][:name]
96
98
  assert_equal "Boxing Day", Date.civil(2015, 12, 28).holidays(:au_qld, :observed)[0][:name]
97
99
 
98
100
  # BOXING DAY - SA gets monday only. same for TAS and NT.
99
- assert_nil Date.civil(2015, 12, 26).holidays(:au_sa)[0]
100
101
  assert_equal "Boxing Day", Date.civil(2015, 12, 28).holidays(:au_sa)[0][:name]
101
- assert_nil Date.civil(2015, 12, 26).holidays(:au_tas)[0]
102
102
  assert_equal "Boxing Day", Date.civil(2015, 12, 28).holidays(:au_tas)[0][:name]
103
- assert_nil Date.civil(2015, 12, 26).holidays(:au_nt)[0]
104
103
  assert_equal "Boxing Day", Date.civil(2015, 12, 28).holidays(:au_nt)[0][:name]
105
104
 
106
105
  assert_equal 'G20 Day', Holidays.on(Date.civil(2014,11,14), :au_qld_brisbane)[0][:name]
@@ -113,6 +112,8 @@ assert_equal 'Royal Hobart Regatta', Holidays.on(Date.civil(2015, 2, 9), :au_tas
113
112
  assert_equal 'Royal Hobart Regatta', Holidays.on(Date.civil(2016, 2, 8), :au_tas_south)[0][:name]
114
113
 
115
114
  # CHRISTMAS DAY - ACT, NSW, QLD, Tas, WA observe on 27th (and 25th) if 25th is a Sunday
115
+ assert_equal "Christmas Day", Date.civil(2016, 12, 25).holidays(:au)[0][:name]
116
+ assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au, :observed)[0][:name]
116
117
  assert_equal "Christmas Day", Date.civil(2016, 12, 25).holidays(:au_qld)[0][:name]
117
118
  assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_qld, :observed)[0][:name]
118
119
  assert_equal "Christmas Day", Date.civil(2016, 12, 25).holidays(:au_nsw)[0][:name]
@@ -130,8 +131,6 @@ assert_equal "Christmas Day", Date.civil(2016, 12, 26).holidays(:au_sa, :observe
130
131
  assert_equal "Boxing Day", Date.civil(2016, 12, 27).holidays(:au_sa)[0][:name]
131
132
 
132
133
  # CHRISTMAS DAY - Victoria and NT don't observe 25th if weekend - xmas is on the 27th
133
- assert_nil Date.civil(2016, 12, 25).holidays(:au_vic)[0]
134
- assert_nil Date.civil(2016, 12, 25).holidays(:au_nt)[0]
135
134
  assert_equal "Boxing Day", Date.civil(2016, 12, 26).holidays(:au_vic)[0][:name]
136
135
  assert_equal "Boxing Day", Date.civil(2016, 12, 26).holidays(:au_nt)[0][:name]
137
136
  assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_vic)[0][:name]
@@ -157,9 +157,36 @@ end
157
157
  :ca_nb,
158
158
  :ca_yk
159
159
  ].each do |province|
160
+ # Remembrance Day observed
161
+ [Date.civil(2010, 11, 11), Date.civil(2012, 11, 12), Date.civil(2017, 11, 13)].each do |date|
162
+ assert_equal 'Remembrance Day', Holidays.on(date, province, :observed)[0][:name]
163
+ end
164
+
165
+ # Remembrance Day
160
166
  assert_equal "Remembrance Day", Holidays.on(Date.civil(2016,11,11), province)[0][:name]
161
167
  end
162
168
 
169
+ # New years observed date
170
+ [Date.civil(2011, 1, 3), Date.civil(2012, 1, 2), Date.civil(2016, 1, 1)].each do |date|
171
+ assert_equal 'New Year\'s Day', Holidays.on(date, :ca, :observed)[0][:name]
172
+ end
173
+
174
+ # Canada Day observed date
175
+ [Date.civil(2011, 7, 1), Date.civil(2012, 7, 2), Date.civil(2017, 7, 3)].each do |date|
176
+ assert_equal 'Canada Day', Holidays.on(date, :ca, :observed)[0][:name]
177
+ end
178
+
179
+ # Christmas observed date
180
+ [Date.civil(2010, 12, 27), Date.civil(2012, 12, 25), Date.civil(2016, 12, 26)].each do |date|
181
+ assert_equal 'Christmas Day', Holidays.on(date, :ca, :observed)[0][:name]
182
+ end
183
+
184
+ # Boxing Day observed date
185
+ [Date.civil(2010, 12, 28), Date.civil(2012, 12, 26), Date.civil(2016, 12, 27),
186
+ Date.civil(2015, 12, 28)].each do |date|
187
+ assert_equal 'Boxing Day', Holidays.on(date, :ca, :observed)[0][:name]
188
+ end
189
+
163
190
 
164
191
  {Date.civil(2013,2,2) => 'Groundhog Day',
165
192
  Date.civil(2013,2,14) => 'Valentine\'s Day',
@@ -9,7 +9,7 @@ class JpDefinitionTests < Test::Unit::TestCase # :nodoc:
9
9
  def test_jp
10
10
  {Date.civil(2008,1,1) => '元日',
11
11
  Date.civil(2010,1,11) => '成人の日',
12
- Date.civil(2008,2,11) => '建国記念日',
12
+ Date.civil(2008,2,11) => '建国記念の日',
13
13
  Date.civil(2008,4,29) => '昭和の日',
14
14
  Date.civil(2008,5,3) => '憲法記念日',
15
15
  Date.civil(2008,5,5) => 'こどもの日',
@@ -157,9 +157,36 @@ end
157
157
  :ca_nb,
158
158
  :ca_yk
159
159
  ].each do |province|
160
+ # Remembrance Day observed
161
+ [Date.civil(2010, 11, 11), Date.civil(2012, 11, 12), Date.civil(2017, 11, 13)].each do |date|
162
+ assert_equal 'Remembrance Day', Holidays.on(date, province, :observed)[0][:name]
163
+ end
164
+
165
+ # Remembrance Day
160
166
  assert_equal "Remembrance Day", Holidays.on(Date.civil(2016,11,11), province)[0][:name]
161
167
  end
162
168
 
169
+ # New years observed date
170
+ [Date.civil(2011, 1, 3), Date.civil(2012, 1, 2), Date.civil(2016, 1, 1)].each do |date|
171
+ assert_equal 'New Year\'s Day', Holidays.on(date, :ca, :observed)[0][:name]
172
+ end
173
+
174
+ # Canada Day observed date
175
+ [Date.civil(2011, 7, 1), Date.civil(2012, 7, 2), Date.civil(2017, 7, 3)].each do |date|
176
+ assert_equal 'Canada Day', Holidays.on(date, :ca, :observed)[0][:name]
177
+ end
178
+
179
+ # Christmas observed date
180
+ [Date.civil(2010, 12, 27), Date.civil(2012, 12, 25), Date.civil(2016, 12, 26)].each do |date|
181
+ assert_equal 'Christmas Day', Holidays.on(date, :ca, :observed)[0][:name]
182
+ end
183
+
184
+ # Boxing Day observed date
185
+ [Date.civil(2010, 12, 28), Date.civil(2012, 12, 26), Date.civil(2016, 12, 27),
186
+ Date.civil(2015, 12, 28)].each do |date|
187
+ assert_equal 'Boxing Day', Holidays.on(date, :ca, :observed)[0][:name]
188
+ end
189
+
163
190
 
164
191
  {Date.civil(2007,1,1) => 'Año nuevo',
165
192
  Date.civil(2007,2,5) => 'Día de la Constitución',
@@ -155,9 +155,9 @@ class HolidaysTests < Test::Unit::TestCase
155
155
  holidays = Holidays.year_holidays([:ca_on], Date.civil(2016, 1, 1))
156
156
  assert_equal 11, holidays.length
157
157
 
158
- # Should return all 5 holidays for 2016 in Australia
158
+ # Should return all 7 holidays for 2016 in Australia
159
159
  holidays = Holidays.year_holidays([:au], Date.civil(2016, 1, 1))
160
- assert_equal 5, holidays.length
160
+ assert_equal 7, holidays.length
161
161
  end
162
162
 
163
163
  def test_year_holidays_without_specified_year
data/test/test_helper.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'coverage_report'
1
+ require File.dirname(__FILE__) + '/coverage_report'
2
2
 
3
3
  $:.unshift(File.expand_path(File.dirname(__FILE__) + '../../lib/'))
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: holidays
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Dunae
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-11-06 00:00:00.000000000 Z
12
+ date: 2016-11-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler