holidays 7.1.0 → 8.5.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,29 @@
1
+ # encoding: utf-8
2
+ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
3
+
4
+ # This file is generated by the Ruby Holiday gem.
5
+ #
6
+ # Definitions loaded: definitions/ng.yaml
7
+ class NgDefinitionTests < Test::Unit::TestCase # :nodoc:
8
+
9
+ def test_ng
10
+ assert_equal "Good Friday", (Holidays.on(Date.civil(2008, 3, 21), [:ng])[0] || {})[:name]
11
+
12
+ assert_equal "Easter Monday", (Holidays.on(Date.civil(2008, 3, 24), [:ng])[0] || {})[:name]
13
+
14
+ assert_equal "New Year's Day", (Holidays.on(Date.civil(2008, 1, 1), [:ng])[0] || {})[:name]
15
+
16
+ assert_equal "Workers' Day", (Holidays.on(Date.civil(2008, 5, 1), [:ng])[0] || {})[:name]
17
+
18
+ assert_equal "Children's Day", (Holidays.on(Date.civil(2008, 5, 27), [:ng], [:informal])[0] || {})[:name]
19
+
20
+ assert_equal "Democracy Day", (Holidays.on(Date.civil(2019, 6, 12), [:ng])[0] || {})[:name]
21
+
22
+ assert_equal "Independence Day", (Holidays.on(Date.civil(2008, 10, 1), [:ng])[0] || {})[:name]
23
+
24
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2008, 12, 25), [:ng])[0] || {})[:name]
25
+
26
+ assert_equal "Boxing Day", (Holidays.on(Date.civil(2008, 12, 26), [:ng])[0] || {})[:name]
27
+
28
+ end
29
+ end
@@ -19,7 +19,7 @@ class NorthamericaDefinitionTests < 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]
224
253
 
225
- assert_equal "Terry Fox Day", (Holidays.on(Date.civil(2020, 8, 3), [:ca_mb])[0] || {})[:name]
254
+ assert_equal "Nunavut Day", (Holidays.on(Date.civil(2020, 7, 9), [:ca_nu])[0] || {})[:name]
226
255
 
227
- assert_equal "Terry Fox Day", (Holidays.on(Date.civil(2015, 8, 3), [:ca_mb])[0] || {})[:name]
256
+ assert_equal "Nunavut Day", (Holidays.on(Date.civil(2021, 7, 9), [:ca_nu])[0] || {})[:name]
228
257
 
229
- assert_equal "Terry Fox Day", (Holidays.on(Date.civil(2045, 8, 7), [:ca_mb])[0] || {})[:name]
258
+ assert_nil (Holidays.on(Date.civil(2019, 7, 9), [:ca_nu])[0] || {})[:name]
259
+
260
+ assert_nil (Holidays.on(Date.civil(2018, 7, 9), [:ca_nu])[0] || {})[:name]
230
261
 
231
262
  assert_equal "Año nuevo", (Holidays.on(Date.civil(2007, 1, 1), [:mx], [:informal])[0] || {})[:name]
232
263
 
@@ -326,10 +357,6 @@ assert_equal "Presidents' Day", (Holidays.on(Date.civil(2018, 2, 19), [:us])[0]
326
357
  assert_nil (Holidays.on(Date.civil(2018, 3, 5), [:us])[0] || {})[:name]
327
358
  assert_nil (Holidays.on(Date.civil(2019, 3, 4), [:us])[0] || {})[:name]
328
359
 
329
- assert_equal "Casimir Pulaski Day", (Holidays.on(Date.civil(2017, 3, 6), [:us_il])[0] || {})[:name]
330
- assert_equal "Casimir Pulaski Day", (Holidays.on(Date.civil(2018, 3, 5), [:us_il])[0] || {})[:name]
331
- assert_equal "Casimir Pulaski Day", (Holidays.on(Date.civil(2019, 3, 4), [:us_il])[0] || {})[:name]
332
-
333
360
  assert_nil (Holidays.on(Date.civil(2017, 3, 7), [:us])[0] || {})[:name]
334
361
  assert_nil (Holidays.on(Date.civil(2018, 3, 6), [:us])[0] || {})[:name]
335
362
  assert_nil (Holidays.on(Date.civil(2019, 3, 5), [:us])[0] || {})[:name]
@@ -366,7 +393,7 @@ assert_equal "Seward's Day", (Holidays.on(Date.civil(2019, 3, 25), [:us_ak])[0]
366
393
  assert_equal "Emancipation Day", (Holidays.on(Date.civil(2022, 4, 15), [:us_dc, :us_ca], [:observed])[0] || {})[:name]
367
394
  assert_equal "Emancipation Day", (Holidays.on(Date.civil(2028, 4, 17), [:us_dc, :us_ca], [:observed])[0] || {})[:name]
368
395
 
369
- assert_equal "Emancipation Day", (Holidays.on(Date.civil(2017, 4, 16), [:us_dc, :us_ca])[0] || {})[:name]
396
+ assert_equal "Emancipation Day", (Holidays.on(Date.civil(2017, 4, 16), [:us_dc])[0] || {})[:name]
370
397
 
371
398
  assert_nil (Holidays.on(Date.civil(2017, 4, 17), [:us])[0] || {})[:name]
372
399
  assert_nil (Holidays.on(Date.civil(2018, 4, 16), [:us])[0] || {})[:name]
@@ -436,6 +463,10 @@ assert_equal "King Kamehameha I Day", (Holidays.on(Date.civil(2022, 6, 10), [:us
436
463
 
437
464
  assert_equal "King Kamehameha I Day", (Holidays.on(Date.civil(2017, 6, 11), [:us_hi])[0] || {})[:name]
438
465
 
466
+ assert_nil (Holidays.on(Date.civil(2021, 6, 19), [:us], [:observed])[0] || {})[:name]
467
+
468
+ assert_equal "Juneteenth National Independence Day", (Holidays.on(Date.civil(2021, 6, 18), [:us], [:observed])[0] || {})[:name]
469
+
439
470
  assert_equal "Emancipation Day in Texas", (Holidays.on(Date.civil(2017, 6, 19), [:us_tx])[0] || {})[:name]
440
471
 
441
472
  assert_nil (Holidays.on(Date.civil(2017, 6, 20), [:us])[0] || {})[:name]
@@ -542,9 +573,9 @@ assert_equal "Nevada Day", (Holidays.on(Date.civil(2019, 10, 25), [:us_nv])[0] |
542
573
  assert_nil (Holidays.on(Date.civil(2018, 11, 6), [:us])[0] || {})[:name]
543
574
  assert_nil (Holidays.on(Date.civil(2021, 11, 2), [:us])[0] || {})[:name]
544
575
 
545
- assert_equal "Election Day", (Holidays.on(Date.civil(2017, 11, 7), [:us_de, :us_hi, :us_il, :us_in, :us_mt, :us_nj, :us_ny, :us_pa, :us_ri])[0] || {})[:name]
546
- assert_equal "Election Day", (Holidays.on(Date.civil(2018, 11, 6), [:us_de, :us_hi, :us_il, :us_in, :us_mt, :us_nj, :us_ny, :us_pa, :us_ri])[0] || {})[:name]
547
- assert_equal "Election Day", (Holidays.on(Date.civil(2021, 11, 2), [:us_de, :us_hi, :us_il, :us_in, :us_mt, :us_nj, :us_ny, :us_pa, :us_ri])[0] || {})[:name]
576
+ assert_equal "Election Day", (Holidays.on(Date.civil(2017, 11, 7), [:us_de, :us_hi, :us_in, :us_mt, :us_nj, :us_ny, :us_pa, :us_ri])[0] || {})[:name]
577
+ assert_equal "Election Day", (Holidays.on(Date.civil(2018, 11, 6), [:us_de, :us_hi, :us_in, :us_mt, :us_nj, :us_ny, :us_pa, :us_ri])[0] || {})[:name]
578
+ assert_equal "Election Day", (Holidays.on(Date.civil(2021, 11, 2), [:us_de, :us_hi, :us_in, :us_mt, :us_nj, :us_ny, :us_pa, :us_ri])[0] || {})[:name]
548
579
 
549
580
  assert_equal "Veterans Day", (Holidays.on(Date.civil(2017, 11, 10), [:us], [:observed])[0] || {})[:name]
550
581
  assert_equal "Veterans Day", (Holidays.on(Date.civil(2018, 11, 12), [:us], [:observed])[0] || {})[:name]
@@ -594,9 +625,9 @@ assert_equal "Christmas Eve (Holiday)", (Holidays.on(Date.civil(2028, 12, 22), [
594
625
  assert_nil (Holidays.on(Date.civil(2022, 12, 26), [:us])[0] || {})[:name]
595
626
  assert_nil (Holidays.on(Date.civil(2027, 12, 27), [:us])[0] || {})[:name]
596
627
 
597
- assert_equal "Christmas Day", (Holidays.on(Date.civil(2021, 12, 27), [:us], [:observed])[0] || {})[:name]
628
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2021, 12, 24), [:us], [:observed])[0] || {})[:name]
598
629
  assert_equal "Christmas Day", (Holidays.on(Date.civil(2022, 12, 26), [:us], [:observed])[0] || {})[:name]
599
- assert_equal "Christmas Day", (Holidays.on(Date.civil(2027, 12, 27), [:us], [:observed])[0] || {})[:name]
630
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2027, 12, 24), [:us], [:observed])[0] || {})[:name]
600
631
 
601
632
  assert_equal "Christmas Day", (Holidays.on(Date.civil(2017, 12, 25), [:us])[0] || {})[:name]
602
633
 
@@ -7,6 +7,12 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class RoDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_ro
10
+ assert_nil (Holidays.on(Date.civil(2017, 4, 14), [:ro])[0] || {})[:name]
11
+
12
+ assert_equal "Paștele - Vinerea Mare", (Holidays.on(Date.civil(2018, 4, 6), [:ro], [:informal])[0] || {})[:name]
13
+
14
+ assert_equal "Paștele - Vinerea Mare", (Holidays.on(Date.civil(2019, 4, 26), [:ro], [:informal])[0] || {})[:name]
15
+
10
16
  assert_equal "Paștele - duminică", (Holidays.on(Date.civil(1961, 4, 9), [:ro], [:informal])[0] || {})[:name]
11
17
 
12
18
  assert_equal "Paștele - luni", (Holidays.on(Date.civil(1961, 4, 10), [:ro], [:informal])[0] || {})[:name]
@@ -33,8 +39,16 @@ class RoDefinitionTests < Test::Unit::TestCase # :nodoc:
33
39
 
34
40
  assert_equal "Anul nou", (Holidays.on(Date.civil(2014, 1, 2), [:ro], [:informal])[0] || {})[:name]
35
41
 
42
+ assert_equal "Unirea Principatelor Române", (Holidays.on(Date.civil(2017, 1, 24), [:ro], [:informal])[0] || {})[:name]
43
+
44
+ assert_nil (Holidays.on(Date.civil(2016, 1, 24), [:ro])[0] || {})[:name]
45
+
36
46
  assert_equal "Ziua muncii", (Holidays.on(Date.civil(2009, 5, 1), [:ro], [:informal])[0] || {})[:name]
37
47
 
48
+ assert_equal "Ziua Copilului", (Holidays.on(Date.civil(2017, 6, 1), [:ro], [:informal])[0] || {})[:name]
49
+
50
+ assert_nil (Holidays.on(Date.civil(2016, 6, 1), [:ro])[0] || {})[:name]
51
+
38
52
  assert_equal "Adormirea Maicii Domnului", (Holidays.on(Date.civil(2012, 8, 15), [:ro], [:informal])[0] || {})[:name]
39
53
 
40
54
  assert_equal "Sfântul Apostol Andrei", (Holidays.on(Date.civil(2013, 11, 30), [:ro], [:informal])[0] || {})[:name]
@@ -31,21 +31,37 @@ class SouthamericaDefinitionTests < 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
 
@@ -179,11 +195,11 @@ class SouthamericaDefinitionTests < Test::Unit::TestCase # :nodoc:
179
195
 
180
196
  assert_equal "Día de la Ascensión", (Holidays.on(Date.civil(2017, 5, 29), [:co])[0] || {})[:name]
181
197
 
182
- assert_equal "Corpus Christi", (Holidays.on(Date.civil(2014, 6, 19), [:co])[0] || {})[:name]
198
+ assert_equal "Corpus Christi", (Holidays.on(Date.civil(2014, 6, 23), [:co])[0] || {})[:name]
183
199
 
184
- assert_equal "Corpus Christi", (Holidays.on(Date.civil(2016, 5, 26), [:co])[0] || {})[:name]
200
+ assert_equal "Corpus Christi", (Holidays.on(Date.civil(2016, 5, 30), [:co])[0] || {})[:name]
185
201
 
186
- assert_equal "Corpus Christi", (Holidays.on(Date.civil(2017, 6, 15), [:co])[0] || {})[:name]
202
+ assert_equal "Corpus Christi", (Holidays.on(Date.civil(2017, 6, 19), [:co])[0] || {})[:name]
187
203
 
188
204
  assert_equal "Sagrado Corazón", (Holidays.on(Date.civil(2014, 6, 30), [:co])[0] || {})[:name]
189
205
 
@@ -22,32 +22,39 @@ class TrDefinitionTests < Test::Unit::TestCase # :nodoc:
22
22
  assert_equal "Ramazan Bayramı", (Holidays.on(Date.civil(2017, 6, 25), [:tr])[0] || {})[:name]
23
23
  assert_equal "Ramazan Bayramı", (Holidays.on(Date.civil(2018, 6, 15), [:tr])[0] || {})[:name]
24
24
  assert_equal "Ramazan Bayramı", (Holidays.on(Date.civil(2019, 6, 4), [:tr])[0] || {})[:name]
25
+ assert_equal "Ramazan Bayramı", (Holidays.on(Date.civil(2020, 5, 24), [:tr])[0] || {})[:name]
25
26
 
26
27
  assert_equal "Ramazan Bayramı (ikinci tatil)", (Holidays.on(Date.civil(2017, 6, 26), [:tr])[0] || {})[:name]
27
28
  assert_equal "Ramazan Bayramı (ikinci tatil)", (Holidays.on(Date.civil(2018, 6, 16), [:tr])[0] || {})[:name]
28
29
  assert_equal "Ramazan Bayramı (ikinci tatil)", (Holidays.on(Date.civil(2019, 6, 5), [:tr])[0] || {})[:name]
30
+ assert_equal "Ramazan Bayramı (ikinci tatil)", (Holidays.on(Date.civil(2020, 5, 25), [:tr])[0] || {})[:name]
29
31
 
30
32
  assert_equal "Ramazan Bayramı (üçüncü tatil)", (Holidays.on(Date.civil(2017, 6, 27), [:tr])[0] || {})[:name]
31
33
  assert_equal "Ramazan Bayramı (üçüncü tatil)", (Holidays.on(Date.civil(2018, 6, 17), [:tr])[0] || {})[:name]
32
34
  assert_equal "Ramazan Bayramı (üçüncü tatil)", (Holidays.on(Date.civil(2019, 6, 6), [:tr])[0] || {})[:name]
35
+ assert_equal "Ramazan Bayramı (üçüncü tatil)", (Holidays.on(Date.civil(2020, 5, 26), [:tr])[0] || {})[:name]
33
36
 
34
37
  assert_equal "Demokrasi ve Milli Birlik Günü", (Holidays.on(Date.civil(2017, 7, 15), [:tr])[0] || {})[:name]
35
38
 
36
39
  assert_equal "Kurban Bayramı", (Holidays.on(Date.civil(2017, 9, 1), [:tr])[0] || {})[:name]
37
40
  assert_equal "Kurban Bayramı", (Holidays.on(Date.civil(2018, 8, 21), [:tr])[0] || {})[:name]
38
41
  assert_equal "Kurban Bayramı", (Holidays.on(Date.civil(2019, 8, 11), [:tr])[0] || {})[:name]
42
+ assert_equal "Kurban Bayramı", (Holidays.on(Date.civil(2020, 7, 31), [:tr])[0] || {})[:name]
39
43
 
40
44
  assert_equal "Kurban Bayramı (ikinci tatil)", (Holidays.on(Date.civil(2017, 9, 2), [:tr])[0] || {})[:name]
41
45
  assert_equal "Kurban Bayramı (ikinci tatil)", (Holidays.on(Date.civil(2018, 8, 22), [:tr])[0] || {})[:name]
42
46
  assert_equal "Kurban Bayramı (ikinci tatil)", (Holidays.on(Date.civil(2019, 8, 12), [:tr])[0] || {})[:name]
47
+ assert_equal "Kurban Bayramı (ikinci tatil)", (Holidays.on(Date.civil(2020, 8, 1), [:tr])[0] || {})[:name]
43
48
 
44
49
  assert_equal "Kurban Bayramı (üçüncü tatil)", (Holidays.on(Date.civil(2017, 9, 3), [:tr])[0] || {})[:name]
45
50
  assert_equal "Kurban Bayramı (üçüncü tatil)", (Holidays.on(Date.civil(2018, 8, 23), [:tr])[0] || {})[:name]
46
51
  assert_equal "Kurban Bayramı (üçüncü tatil)", (Holidays.on(Date.civil(2019, 8, 13), [:tr])[0] || {})[:name]
52
+ assert_equal "Kurban Bayramı (üçüncü tatil)", (Holidays.on(Date.civil(2020, 8, 2), [:tr])[0] || {})[:name]
47
53
 
48
54
  assert_equal "Kurban Bayramı (dördüncü tatil)", (Holidays.on(Date.civil(2017, 9, 4), [:tr])[0] || {})[:name]
49
55
  assert_equal "Kurban Bayramı (dördüncü tatil)", (Holidays.on(Date.civil(2018, 8, 24), [:tr])[0] || {})[:name]
50
56
  assert_equal "Kurban Bayramı (dördüncü tatil)", (Holidays.on(Date.civil(2019, 8, 14), [:tr])[0] || {})[:name]
57
+ assert_equal "Kurban Bayramı (dördüncü tatil)", (Holidays.on(Date.civil(2020, 8, 3), [:tr])[0] || {})[:name]
51
58
 
52
59
  end
53
60
  end
@@ -87,10 +87,6 @@ assert_equal "Presidents' Day", (Holidays.on(Date.civil(2018, 2, 19), [:us])[0]
87
87
  assert_nil (Holidays.on(Date.civil(2018, 3, 5), [:us])[0] || {})[:name]
88
88
  assert_nil (Holidays.on(Date.civil(2019, 3, 4), [:us])[0] || {})[:name]
89
89
 
90
- assert_equal "Casimir Pulaski Day", (Holidays.on(Date.civil(2017, 3, 6), [:us_il])[0] || {})[:name]
91
- assert_equal "Casimir Pulaski Day", (Holidays.on(Date.civil(2018, 3, 5), [:us_il])[0] || {})[:name]
92
- assert_equal "Casimir Pulaski Day", (Holidays.on(Date.civil(2019, 3, 4), [:us_il])[0] || {})[:name]
93
-
94
90
  assert_nil (Holidays.on(Date.civil(2017, 3, 7), [:us])[0] || {})[:name]
95
91
  assert_nil (Holidays.on(Date.civil(2018, 3, 6), [:us])[0] || {})[:name]
96
92
  assert_nil (Holidays.on(Date.civil(2019, 3, 5), [:us])[0] || {})[:name]
@@ -127,7 +123,7 @@ assert_equal "Seward's Day", (Holidays.on(Date.civil(2019, 3, 25), [:us_ak])[0]
127
123
  assert_equal "Emancipation Day", (Holidays.on(Date.civil(2022, 4, 15), [:us_dc, :us_ca], [:observed])[0] || {})[:name]
128
124
  assert_equal "Emancipation Day", (Holidays.on(Date.civil(2028, 4, 17), [:us_dc, :us_ca], [:observed])[0] || {})[:name]
129
125
 
130
- assert_equal "Emancipation Day", (Holidays.on(Date.civil(2017, 4, 16), [:us_dc, :us_ca])[0] || {})[:name]
126
+ assert_equal "Emancipation Day", (Holidays.on(Date.civil(2017, 4, 16), [:us_dc])[0] || {})[:name]
131
127
 
132
128
  assert_nil (Holidays.on(Date.civil(2017, 4, 17), [:us])[0] || {})[:name]
133
129
  assert_nil (Holidays.on(Date.civil(2018, 4, 16), [:us])[0] || {})[:name]
@@ -197,6 +193,10 @@ assert_equal "King Kamehameha I Day", (Holidays.on(Date.civil(2022, 6, 10), [:us
197
193
 
198
194
  assert_equal "King Kamehameha I Day", (Holidays.on(Date.civil(2017, 6, 11), [:us_hi])[0] || {})[:name]
199
195
 
196
+ assert_nil (Holidays.on(Date.civil(2021, 6, 19), [:us], [:observed])[0] || {})[:name]
197
+
198
+ assert_equal "Juneteenth National Independence Day", (Holidays.on(Date.civil(2021, 6, 18), [:us], [:observed])[0] || {})[:name]
199
+
200
200
  assert_equal "Emancipation Day in Texas", (Holidays.on(Date.civil(2017, 6, 19), [:us_tx])[0] || {})[:name]
201
201
 
202
202
  assert_nil (Holidays.on(Date.civil(2017, 6, 20), [:us])[0] || {})[:name]
@@ -303,9 +303,9 @@ assert_equal "Nevada Day", (Holidays.on(Date.civil(2019, 10, 25), [:us_nv])[0] |
303
303
  assert_nil (Holidays.on(Date.civil(2018, 11, 6), [:us])[0] || {})[:name]
304
304
  assert_nil (Holidays.on(Date.civil(2021, 11, 2), [:us])[0] || {})[:name]
305
305
 
306
- assert_equal "Election Day", (Holidays.on(Date.civil(2017, 11, 7), [:us_de, :us_hi, :us_il, :us_in, :us_mt, :us_nj, :us_ny, :us_pa, :us_ri])[0] || {})[:name]
307
- assert_equal "Election Day", (Holidays.on(Date.civil(2018, 11, 6), [:us_de, :us_hi, :us_il, :us_in, :us_mt, :us_nj, :us_ny, :us_pa, :us_ri])[0] || {})[:name]
308
- assert_equal "Election Day", (Holidays.on(Date.civil(2021, 11, 2), [:us_de, :us_hi, :us_il, :us_in, :us_mt, :us_nj, :us_ny, :us_pa, :us_ri])[0] || {})[:name]
306
+ assert_equal "Election Day", (Holidays.on(Date.civil(2017, 11, 7), [:us_de, :us_hi, :us_in, :us_mt, :us_nj, :us_ny, :us_pa, :us_ri])[0] || {})[:name]
307
+ assert_equal "Election Day", (Holidays.on(Date.civil(2018, 11, 6), [:us_de, :us_hi, :us_in, :us_mt, :us_nj, :us_ny, :us_pa, :us_ri])[0] || {})[:name]
308
+ assert_equal "Election Day", (Holidays.on(Date.civil(2021, 11, 2), [:us_de, :us_hi, :us_in, :us_mt, :us_nj, :us_ny, :us_pa, :us_ri])[0] || {})[:name]
309
309
 
310
310
  assert_equal "Veterans Day", (Holidays.on(Date.civil(2017, 11, 10), [:us], [:observed])[0] || {})[:name]
311
311
  assert_equal "Veterans Day", (Holidays.on(Date.civil(2018, 11, 12), [:us], [:observed])[0] || {})[:name]
@@ -355,9 +355,9 @@ assert_equal "Christmas Eve (Holiday)", (Holidays.on(Date.civil(2028, 12, 22), [
355
355
  assert_nil (Holidays.on(Date.civil(2022, 12, 26), [:us])[0] || {})[:name]
356
356
  assert_nil (Holidays.on(Date.civil(2027, 12, 27), [:us])[0] || {})[:name]
357
357
 
358
- assert_equal "Christmas Day", (Holidays.on(Date.civil(2021, 12, 27), [:us], [:observed])[0] || {})[:name]
358
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2021, 12, 24), [:us], [:observed])[0] || {})[:name]
359
359
  assert_equal "Christmas Day", (Holidays.on(Date.civil(2022, 12, 26), [:us], [:observed])[0] || {})[:name]
360
- assert_equal "Christmas Day", (Holidays.on(Date.civil(2027, 12, 27), [:us], [:observed])[0] || {})[:name]
360
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2027, 12, 24), [:us], [:observed])[0] || {})[:name]
361
361
 
362
362
  assert_equal "Christmas Day", (Holidays.on(Date.civil(2017, 12, 25), [:us])[0] || {})[:name]
363
363
 
@@ -1,5 +1,6 @@
1
1
  require File.expand_path(File.dirname(__FILE__)) + '/../../test_helper'
2
2
 
3
+ require 'date'
3
4
  require 'holidays/core_extensions/date'
4
5
 
5
6
  class Date
@@ -114,8 +115,8 @@ class CoreExtensionDateTests < Test::Unit::TestCase
114
115
 
115
116
  def test_datetime_holiday?
116
117
  # in situations with activesupport
117
- assert DateTime.now.to_date.holiday?('test') if DateTime.now.respond_to?(:to_date)
118
- assert DateTime.now.holiday?('test')
118
+ assert DateTime.civil(2008, 1, 1).to_date.holiday?('ca')
119
+ assert DateTime.civil(2008, 1, 1).holiday?('ca')
119
120
  end
120
121
 
121
122
  end
@@ -143,31 +143,25 @@ class GeneratorTests < Test::Unit::TestCase
143
143
  :name => "after_year",
144
144
  :regions => [:custom_year_range_file],
145
145
  :mday => 1,
146
- :year_ranges => [{"after" => 2016}]
146
+ :year_ranges => {:from => 2016}
147
147
  },
148
148
  {
149
149
  :name => "before_year",
150
150
  :regions => [:custom_year_range_file],
151
151
  :mday => 2,
152
- :year_ranges => [{"before" => 2017}]
152
+ :year_ranges => {:until => 2017}
153
153
  },
154
154
  {
155
155
  :name => "between_year",
156
156
  :regions => [:custom_year_range_file],
157
157
  :mday => 3,
158
- :year_ranges => [{"between" => 2016..2018}]
158
+ :year_ranges => {:between => 2016..2018 }
159
159
  },
160
160
  {
161
161
  :name => "limited_year",
162
162
  :regions => [:custom_year_range_file],
163
163
  :mday => 4,
164
- :year_ranges => [{"limited" => [2016,2018,2019]}]
165
- },
166
- {
167
- :name => "multiple_conditions",
168
- :regions => [:custom_year_range_file],
169
- :mday => 5,
170
- :year_ranges => [{"before" => 2015}, {"after" => 2017}]
164
+ :year_ranges => {:limited => [2016,2018,2019]}
171
165
  }
172
166
  ]
173
167
  }
@@ -183,7 +177,7 @@ class GeneratorTests < Test::Unit::TestCase
183
177
 
184
178
  @test_source_generator.expects(:call).with('test', ['test/data/test_custom_year_range_holiday_defs.yaml'], ['parsed tests']).returns('test source')
185
179
 
186
- @module_source_generator.expects(:call).with("test", ["test/data/test_custom_year_range_holiday_defs.yaml"], [:custom_year_range_file], [" 6 => [{:mday => 1, :year_ranges => [{:after => 2016}],:name => \"after_year\", :regions => [:custom_year_range_file]},\n {:mday => 2, :year_ranges => [{:before => 2017}],:name => \"before_year\", :regions => [:custom_year_range_file]},\n {:mday => 3, :year_ranges => [{:between => 2016..2018}],:name => \"between_year\", :regions => [:custom_year_range_file]},\n {:mday => 4, :year_ranges => [{:limited => [2016, 2018, 2019]}],:name => \"limited_year\", :regions => [:custom_year_range_file]},\n {:mday => 5, :year_ranges => [{:before => 2015},{:after => 2017}],:name => \"multiple_conditions\", :regions => [:custom_year_range_file]}]"], "").returns('module_source')
180
+ @module_source_generator.expects(:call).with("test", ["test/data/test_custom_year_range_holiday_defs.yaml"], [:custom_year_range_file], [" 6 => [{:mday => 1, :year_ranges => { :from => 2016 },:name => \"after_year\", :regions => [:custom_year_range_file]},\n {:mday => 2, :year_ranges => { :until => 2017 },:name => \"before_year\", :regions => [:custom_year_range_file]},\n {:mday => 3, :year_ranges => { :between => 2016..2018 },:name => \"between_year\", :regions => [:custom_year_range_file]},\n {:mday => 4, :year_ranges => { :limited => [2016, 2018, 2019] },:name => \"limited_year\", :regions => [:custom_year_range_file]}]"], "").returns('module_source')
187
181
 
188
182
  regions, rules_by_month, custom_methods, tests = @generator.parse_definition_files(files)
189
183
  module_src = @generator.generate_definition_source("test", files, regions, rules_by_month, custom_methods, tests)[0]
@@ -229,11 +223,4 @@ class GeneratorTests < Test::Unit::TestCase
229
223
 
230
224
  assert_equal 'test source', test_src
231
225
  end
232
-
233
- #TODO Missing test scenarios. Adding here so I don't forget when I split this
234
- # apart into smaller components.
235
- #
236
- # 1) If a year_range contains empty entries then we should blow up.
237
- # 2) If year_range contains invalid (i.e. too many types per entry) then
238
- # we should blow up
239
226
  end
@@ -109,7 +109,7 @@ class HolidaysByMonthRepoTests < Test::Unit::TestCase
109
109
  assert_equal(expected, @subject.all)
110
110
  end
111
111
 
112
- def test_add_is_successful_and_updates_regions_to_existing_matching_definitions
112
+ def test_add_is_successful_if_only_region_is_different_and_updates_regions_to_existing_matching_definitions
113
113
  target_holidays = {0 => [:mday => 1, :name => "Test", :regions => [:test2]]}
114
114
 
115
115
  @subject.add(@existing_holidays_by_month)
@@ -152,4 +152,124 @@ class HolidaysByMonthRepoTests < Test::Unit::TestCase
152
152
  @subject.find_by_month(-1)
153
153
  end
154
154
  end
155
+
156
+ def test_add_is_successful_if_only_function_is_different
157
+ initial_holidays = {0=> [{:mday => 1, :name=>"Test", :regions=>[:test], :function=>"easter(year)", :function_arguments=>[:year]}]}
158
+
159
+ @subject.add(initial_holidays)
160
+
161
+ second_holidays = {0=> [{:mday => 1, :name=>"Test", :regions=>[:test2], :function=>"orthodox_easter(year)", :function_arguments=>[:year]}]}
162
+ @subject.add(second_holidays)
163
+
164
+ expected = {
165
+ 0 => [
166
+ {
167
+ :function=>"easter(year)",
168
+ :function_arguments=>[:year],
169
+ :mday=>1,
170
+ :name=>"Test",
171
+ :regions=>[:test]
172
+ },
173
+ {
174
+ :function=>"orthodox_easter(year)",
175
+ :function_arguments=>[:year],
176
+ :mday=>1,
177
+ :name=>"Test",
178
+ :regions=>[:test2]
179
+ }
180
+ ]
181
+ }
182
+
183
+ assert_equal(expected, @subject.all)
184
+ end
185
+
186
+ def test_add_is_successful_if_only_function_modifier_is_different
187
+ initial_holidays = {0=> [{:mday => 1, :name=>"Test", :regions=>[:test], :function=>"easter(year)", :function_modifier=>1, :function_arguments=>[:year]}]}
188
+
189
+ @subject.add(initial_holidays)
190
+
191
+ second_holidays = {0=> [{:mday => 1, :name=>"Test", :regions=>[:test2], :function=>"easter(year)", :function_modifier=>2, :function_arguments=>[:year]}]}
192
+ @subject.add(second_holidays)
193
+
194
+ expected = {
195
+ 0 => [
196
+ {
197
+ :function=>"easter(year)",
198
+ :function_arguments=>[:year],
199
+ :function_modifier=>1,
200
+ :mday=>1,
201
+ :name=>"Test",
202
+ :regions=>[:test]
203
+ },
204
+ {
205
+ :function=>"easter(year)",
206
+ :function_arguments=>[:year],
207
+ :function_modifier=>2,
208
+ :mday=>1,
209
+ :name=>"Test",
210
+ :regions=>[:test2]
211
+ }
212
+ ]
213
+ }
214
+
215
+ assert_equal(expected, @subject.all)
216
+ end
217
+
218
+ def test_add_is_successful_if_only_observed_is_different
219
+ initial_holidays = {0=> [{:mday => 1, :name=>"Test", :regions=>[:test], :observed=>"to_weekday_if_weekend(year)", :function_arguments=>[:year]}]}
220
+
221
+ @subject.add(initial_holidays)
222
+
223
+ second_holidays = {0=> [{:mday => 1, :name=>"Test", :regions=>[:test2], :observed =>"to_friday_if_saturday(year)", :function_arguments=>[:year]}]}
224
+ @subject.add(second_holidays)
225
+
226
+ expected = {
227
+ 0 => [
228
+ {
229
+ :observed =>"to_weekday_if_weekend(year)",
230
+ :function_arguments=>[:year],
231
+ :mday=>1,
232
+ :name=>"Test",
233
+ :regions=>[:test]
234
+ },
235
+ {
236
+ :observed =>"to_friday_if_saturday(year)",
237
+ :function_arguments=>[:year],
238
+ :mday=>1,
239
+ :name=>"Test",
240
+ :regions=>[:test2]
241
+ }
242
+ ]
243
+ }
244
+
245
+ assert_equal(expected, @subject.all)
246
+ end
247
+
248
+ def test_add_is_successful_if_only_year_ranges_is_different
249
+ initial_holidays = {0=> [{:mday => 1, :name=>"Test", :regions=>[:test], :year_ranges => {:from => 1990}}]}
250
+
251
+ @subject.add(initial_holidays)
252
+
253
+ second_holidays = {0=> [{:mday => 1, :name=>"Test", :regions=>[:test2], :year_ranges => {:until => 2002}}]}
254
+ @subject.add(second_holidays)
255
+
256
+ expected = {
257
+ 0 => [
258
+ {
259
+ :mday=>1,
260
+ :name=>"Test",
261
+ :regions=>[:test],
262
+ :year_ranges => {:from => 1990}
263
+ },
264
+ {
265
+ :mday=>1,
266
+ :name=>"Test",
267
+ :regions=>[:test2],
268
+ :year_ranges => {:until => 2002}
269
+ }
270
+ ]
271
+ }
272
+
273
+ assert_equal(expected, @subject.all)
274
+ end
155
275
  end