holidays 5.7.0 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/.gitmodules +1 -1
  3. data/CHANGELOG.md +11 -0
  4. data/lib/generated_definitions/north_america.rb +1 -1
  5. data/lib/generated_definitions/tr.rb +1 -0
  6. data/lib/generated_definitions/us.rb +1 -1
  7. data/lib/holidays/definition/context/generator.rb +5 -36
  8. data/lib/holidays/definition/decorator/test.rb +37 -0
  9. data/lib/holidays/definition/entity/test.rb +11 -0
  10. data/lib/holidays/definition/generator/test.rb +51 -0
  11. data/lib/holidays/definition/parser/test.rb +86 -0
  12. data/lib/holidays/definition/validator/test.rb +71 -0
  13. data/lib/holidays/errors.rb +3 -0
  14. data/lib/holidays/factory/definition.rb +24 -0
  15. data/lib/holidays/version.rb +1 -1
  16. data/test/coverage_report.rb +1 -0
  17. data/test/data/test_custom_year_range_holiday_defs.yaml +7 -0
  18. data/test/data/test_multiple_custom_holiday_defs.yaml +7 -4
  19. data/test/data/test_single_custom_holiday_defs.yaml +7 -4
  20. data/test/data/test_single_custom_holiday_with_custom_procs.yaml +11 -7
  21. data/test/defs/test_defs_ar.rb +33 -19
  22. data/test/defs/test_defs_at.rb +14 -11
  23. data/test/defs/test_defs_au.rb +172 -141
  24. data/test/defs/test_defs_be_fr.rb +23 -14
  25. data/test/defs/test_defs_be_nl.rb +23 -14
  26. data/test/defs/test_defs_bg.rb +29 -17
  27. data/test/defs/test_defs_br.rb +33 -19
  28. data/test/defs/test_defs_ca.rb +175 -176
  29. data/test/defs/test_defs_ch.rb +29 -23
  30. data/test/defs/test_defs_cl.rb +49 -27
  31. data/test/defs/test_defs_cr.rb +17 -11
  32. data/test/defs/test_defs_cz.rb +25 -15
  33. data/test/defs/test_defs_de.rb +52 -61
  34. data/test/defs/test_defs_dk.rb +31 -19
  35. data/test/defs/test_defs_ecb_target.rb +14 -10
  36. data/test/defs/test_defs_ee.rb +28 -20
  37. data/test/defs/test_defs_el.rb +29 -17
  38. data/test/defs/test_defs_es.rb +114 -52
  39. data/test/defs/test_defs_europe.rb +1154 -715
  40. data/test/defs/test_defs_federal_reserve.rb +99 -57
  41. data/test/defs/test_defs_fedex.rb +19 -12
  42. data/test/defs/test_defs_fi.rb +47 -27
  43. data/test/defs/test_defs_fr.rb +29 -24
  44. data/test/defs/test_defs_gb.rb +90 -51
  45. data/test/defs/test_defs_ge.rb +40 -28
  46. data/test/defs/test_defs_hk.rb +47 -26
  47. data/test/defs/test_defs_hr.rb +32 -18
  48. data/test/defs/test_defs_hu.rb +26 -16
  49. data/test/defs/test_defs_ie.rb +41 -25
  50. data/test/defs/test_defs_is.rb +39 -22
  51. data/test/defs/test_defs_it.rb +23 -14
  52. data/test/defs/test_defs_jp.rb +112 -59
  53. data/test/defs/test_defs_kr.rb +25 -17
  54. data/test/defs/test_defs_li.rb +20 -20
  55. data/test/defs/test_defs_lt.rb +51 -30
  56. data/test/defs/test_defs_lu.rb +17 -12
  57. data/test/defs/test_defs_ma.rb +17 -11
  58. data/test/defs/test_defs_mt_en.rb +28 -19
  59. data/test/defs/test_defs_mt_mt.rb +28 -19
  60. data/test/defs/test_defs_mx.rb +33 -22
  61. data/test/defs/test_defs_my.rb +11 -8
  62. data/test/defs/test_defs_nerc.rb +17 -11
  63. data/test/defs/test_defs_nl.rb +21 -13
  64. data/test/defs/test_defs_no.rb +31 -18
  65. data/test/defs/test_defs_north_america.rb +507 -393
  66. data/test/defs/test_defs_nyse.rb +26 -15
  67. data/test/defs/test_defs_nz.rb +47 -28
  68. data/test/defs/test_defs_pe.rb +35 -20
  69. data/test/defs/test_defs_ph.rb +17 -11
  70. data/test/defs/test_defs_pl.rb +200 -119
  71. data/test/defs/test_defs_pt.rb +33 -24
  72. data/test/defs/test_defs_ro.rb +39 -24
  73. data/test/defs/test_defs_rs_cyrl.rb +33 -26
  74. data/test/defs/test_defs_rs_la.rb +33 -26
  75. data/test/defs/test_defs_ru.rb +22 -16
  76. data/test/defs/test_defs_scandinavia.rb +193 -116
  77. data/test/defs/test_defs_se.rb +47 -28
  78. data/test/defs/test_defs_sg.rb +13 -9
  79. data/test/defs/test_defs_si.rb +93 -24
  80. data/test/defs/test_defs_sk.rb +29 -17
  81. data/test/defs/test_defs_tn.rb +15 -10
  82. data/test/defs/test_defs_tr.rb +39 -30
  83. data/test/defs/test_defs_united_nations.rb +0 -1
  84. data/test/defs/test_defs_ups.rb +19 -12
  85. data/test/defs/test_defs_us.rb +333 -217
  86. data/test/defs/test_defs_ve.rb +23 -16
  87. data/test/defs/test_defs_vi.rb +10 -8
  88. data/test/defs/test_defs_za.rb +23 -14
  89. data/test/holidays/definition/context/test_generator.rb +40 -13
  90. data/test/holidays/definition/decorator/test_test.rb +123 -0
  91. data/test/holidays/definition/generator/test_test.rb +113 -0
  92. data/test/holidays/definition/parser/test_test.rb +142 -0
  93. data/test/holidays/definition/validator/test_region.rb +5 -0
  94. data/test/holidays/definition/validator/test_test.rb +60 -0
  95. metadata +15 -8
  96. data/test/holidays/factory/test_date_calculator.rb +0 -32
  97. data/test/holidays/factory/test_definition.rb +0 -62
  98. data/test/holidays/factory/test_finder.rb +0 -25
@@ -7,33 +7,39 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class ChDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_ch
10
- { Date.civil(2012,8,1) => 'Bundesfeiertag',
11
- Date.civil(2012,12,25) => 'Weihnachten',
12
- Date.civil(2012,05,17) => 'Auffahrt'
13
- }.each do |date, name|
14
- assert_equal name, (Holidays.on(date, :ch)[0] || {})[:name]
15
- end
10
+ assert_equal "Bundesfeiertag", (Holidays.on(Date.civil(2012, 8, 1), [:ch])[0] || {})[:name]
16
11
 
17
- { Date.civil(2012,8,1) => 'Bundesfeiertag',
18
- Date.civil(2012,12,25) => 'Weihnachten',
19
- Date.civil(2012,05,17) => 'Auffahrt',
20
- Date.civil(2012,5,1) => 'Tag der Arbeit',
21
- Date.civil(2012,12,26) => 'Stefanstag'
22
- }.each do |date, name|
23
- assert_equal name, (Holidays.on(date, :ch_zh)[0] || {})[:name]
24
- end
12
+ assert_equal "Weihnachten", (Holidays.on(Date.civil(2012, 12, 25), [:ch])[0] || {})[:name]
25
13
 
26
- [Date.civil(2012,9,17), Date.civil(2013,9,16), Date.civil(2014,9,22)].each do |date|
27
- assert_equal 'Lundi du Jeûne fédéral', (Holidays.on(date, :ch_vd)[0] || {})[:name]
28
- end
14
+ assert_equal "Auffahrt", (Holidays.on(Date.civil(2012, 5, 17), [:ch])[0] || {})[:name]
29
15
 
30
- [Date.civil(2012,9,6), Date.civil(2013,9,5), Date.civil(2014,9,11)].each do |date|
31
- assert_equal 'Jeûne genevois', (Holidays.on(date, :ch_ge)[0] || {})[:name]
32
- end
16
+ assert_equal "Bundesfeiertag", (Holidays.on(Date.civil(2012, 8, 1), [:ch_zh])[0] || {})[:name]
33
17
 
34
- [Date.civil(2012,4,12), Date.civil(2013,4,4), Date.civil(2014,4,3)].each do |date|
35
- assert_equal 'Näfelser Fahrt', (Holidays.on(date, :ch_gl)[0] || {})[:name]
36
- end
18
+ assert_equal "Weihnachten", (Holidays.on(Date.civil(2012, 12, 25), [:ch_zh])[0] || {})[:name]
19
+
20
+ assert_equal "Auffahrt", (Holidays.on(Date.civil(2012, 5, 17), [:ch_zh])[0] || {})[:name]
21
+
22
+ assert_equal "Tag der Arbeit", (Holidays.on(Date.civil(2012, 5, 1), [:ch_zh])[0] || {})[:name]
23
+
24
+ assert_equal "Stefanstag", (Holidays.on(Date.civil(2012, 12, 26), [:ch_zh])[0] || {})[:name]
25
+
26
+ assert_equal "Lundi du Jeûne fédéral", (Holidays.on(Date.civil(2012, 9, 17), [:ch_vd])[0] || {})[:name]
27
+
28
+ assert_equal "Lundi du Jeûne fédéral", (Holidays.on(Date.civil(2013, 9, 16), [:ch_vd])[0] || {})[:name]
29
+
30
+ assert_equal "Lundi du Jeûne fédéral", (Holidays.on(Date.civil(2014, 9, 22), [:ch_vd])[0] || {})[:name]
31
+
32
+ assert_equal "Jeûne genevois", (Holidays.on(Date.civil(2012, 9, 6), [:ch_ge])[0] || {})[:name]
33
+
34
+ assert_equal "Jeûne genevois", (Holidays.on(Date.civil(2013, 9, 5), [:ch_ge])[0] || {})[:name]
35
+
36
+ assert_equal "Jeûne genevois", (Holidays.on(Date.civil(2014, 9, 11), [:ch_ge])[0] || {})[:name]
37
+
38
+ assert_equal "Näfelser Fahrt", (Holidays.on(Date.civil(2012, 4, 12), [:ch_gl])[0] || {})[:name]
39
+
40
+ assert_equal "Näfelser Fahrt", (Holidays.on(Date.civil(2013, 4, 4), [:ch_gl])[0] || {})[:name]
41
+
42
+ assert_equal "Näfelser Fahrt", (Holidays.on(Date.civil(2014, 4, 3), [:ch_gl])[0] || {})[:name]
37
43
 
38
44
  end
39
45
  end
@@ -7,33 +7,55 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class ClDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_cl
10
- {Date.civil(2014,1,1) => 'Año Nuevo',
11
- Date.civil(2011,4,22) => 'Viernes Santo',
12
- Date.civil(2011,4,23) => 'Sábado Santo',
13
- Date.civil(2012,4,6) => 'Viernes Santo',
14
- Date.civil(2012,4,7) => 'Sábado Santo',
15
- Date.civil(2013,3,29) => 'Viernes Santo',
16
- Date.civil(2013,3,30) => 'Sábado Santo',
17
- Date.civil(2014,4,18) => 'Viernes Santo',
18
- Date.civil(2014,4,19) => 'Sábado Santo',
19
- Date.civil(2015,4,3) => 'Viernes Santo',
20
- Date.civil(2015,4,4) => 'Sábado Santo',
21
- Date.civil(2016,3,25) => 'Viernes Santo',
22
- Date.civil(2016,3,26) => 'Sábado Santo',
23
- Date.civil(2014,5,1) => 'Día del Trabajo',
24
- Date.civil(2014,5,21) => "Día de las Glorias Navales",
25
- Date.civil(2014,6,29) => "San Pedro y San Pablo",
26
- Date.civil(2014,7,16) => "Día de la Virgen del Carmen",
27
- Date.civil(2014,8,15) => "Asunción de la Virgen",
28
- Date.civil(2014,9,18) => "Independencia Nacional",
29
- Date.civil(2014,9,19) => "Día de las Glorias del Ejército",
30
- Date.civil(2014,10,12) => "Encuentro de Dos Mundos",
31
- Date.civil(2014,10,31) => "Día de las Iglesias Evangélicas y Protestantes",
32
- Date.civil(2014,11,1) => "Día de Todos los Santos",
33
- Date.civil(2014,12,8) => 'Inmaculada Concepción de María',
34
- Date.civil(2014,12,25) => 'Navidad'}.each do |date, name|
35
- assert_equal name, (Holidays.on(date, :cl, :informal)[0] || {})[:name]
36
- end
10
+ assert_equal "Año Nuevo", (Holidays.on(Date.civil(2014, 1, 1), [:cl], [:informal])[0] || {})[:name]
11
+
12
+ assert_equal "Viernes Santo", (Holidays.on(Date.civil(2011, 4, 22), [:cl], [:informal])[0] || {})[:name]
13
+
14
+ assert_equal "Sábado Santo", (Holidays.on(Date.civil(2011, 4, 23), [:cl], [:informal])[0] || {})[:name]
15
+
16
+ assert_equal "Viernes Santo", (Holidays.on(Date.civil(2012, 4, 6), [:cl], [:informal])[0] || {})[:name]
17
+
18
+ assert_equal "Sábado Santo", (Holidays.on(Date.civil(2012, 4, 7), [:cl], [:informal])[0] || {})[:name]
19
+
20
+ assert_equal "Viernes Santo", (Holidays.on(Date.civil(2013, 3, 29), [:cl], [:informal])[0] || {})[:name]
21
+
22
+ assert_equal "Sábado Santo", (Holidays.on(Date.civil(2013, 3, 30), [:cl], [:informal])[0] || {})[:name]
23
+
24
+ assert_equal "Viernes Santo", (Holidays.on(Date.civil(2014, 4, 18), [:cl], [:informal])[0] || {})[:name]
25
+
26
+ assert_equal "Sábado Santo", (Holidays.on(Date.civil(2014, 4, 19), [:cl], [:informal])[0] || {})[:name]
27
+
28
+ assert_equal "Viernes Santo", (Holidays.on(Date.civil(2015, 4, 3), [:cl], [:informal])[0] || {})[:name]
29
+
30
+ assert_equal "Sábado Santo", (Holidays.on(Date.civil(2015, 4, 4), [:cl], [:informal])[0] || {})[:name]
31
+
32
+ assert_equal "Viernes Santo", (Holidays.on(Date.civil(2016, 3, 25), [:cl], [:informal])[0] || {})[:name]
33
+
34
+ assert_equal "Sábado Santo", (Holidays.on(Date.civil(2016, 3, 26), [:cl], [:informal])[0] || {})[:name]
35
+
36
+ assert_equal "Día del Trabajo", (Holidays.on(Date.civil(2014, 5, 1), [:cl], [:informal])[0] || {})[:name]
37
+
38
+ assert_equal "Día de las Glorias Navales", (Holidays.on(Date.civil(2014, 5, 21), [:cl], [:informal])[0] || {})[:name]
39
+
40
+ assert_equal "San Pedro y San Pablo", (Holidays.on(Date.civil(2014, 6, 29), [:cl], [:informal])[0] || {})[:name]
41
+
42
+ assert_equal "Día de la Virgen del Carmen", (Holidays.on(Date.civil(2014, 7, 16), [:cl], [:informal])[0] || {})[:name]
43
+
44
+ assert_equal "Asunción de la Virgen", (Holidays.on(Date.civil(2014, 8, 15), [:cl], [:informal])[0] || {})[:name]
45
+
46
+ assert_equal "Independencia Nacional", (Holidays.on(Date.civil(2014, 9, 18), [:cl], [:informal])[0] || {})[:name]
47
+
48
+ assert_equal "Día de las Glorias del Ejército", (Holidays.on(Date.civil(2014, 9, 19), [:cl], [:informal])[0] || {})[:name]
49
+
50
+ assert_equal "Encuentro de Dos Mundos", (Holidays.on(Date.civil(2014, 10, 12), [:cl], [:informal])[0] || {})[:name]
51
+
52
+ assert_equal "Día de las Iglesias Evangélicas y Protestantes", (Holidays.on(Date.civil(2014, 10, 31), [:cl], [:informal])[0] || {})[:name]
53
+
54
+ assert_equal "Día de Todos los Santos", (Holidays.on(Date.civil(2014, 11, 1), [:cl], [:informal])[0] || {})[:name]
55
+
56
+ assert_equal "Inmaculada Concepción de María", (Holidays.on(Date.civil(2014, 12, 8), [:cl], [:informal])[0] || {})[:name]
57
+
58
+ assert_equal "Navidad", (Holidays.on(Date.civil(2014, 12, 25), [:cl], [:informal])[0] || {})[:name]
37
59
 
38
60
  end
39
61
  end
@@ -7,17 +7,23 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class CrDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_cr
10
- {Date.civil(2015,1,1) => 'Año Nuevo',
11
- Date.civil(2015,4,11) => 'Día de Juan Santamaría',
12
- Date.civil(2015,5,1) => 'Día del Trabajador',
13
- Date.civil(2015,7,25) => 'Día de la Anexión de Guanacaste',
14
- Date.civil(2015,8,2) => 'Día de la Virgen de los Angeles',
15
- Date.civil(2015,8,15) => 'Día de la Madre',
16
- Date.civil(2015,9,15) => 'Día de la Independencia',
17
- Date.civil(2015,10,12) => 'Día de las Culturas',
18
- Date.civil(2016,12,25) => 'Navidad'}.each do |date, name|
19
- assert_equal name, (Holidays.on(date, :cr)[0] || {})[:name]
20
- end
10
+ assert_equal "Año Nuevo", (Holidays.on(Date.civil(2015, 1, 1), [:cr])[0] || {})[:name]
11
+
12
+ assert_equal "Día de Juan Santamaría", (Holidays.on(Date.civil(2015, 4, 11), [:cr])[0] || {})[:name]
13
+
14
+ assert_equal "Día del Trabajador", (Holidays.on(Date.civil(2015, 5, 1), [:cr])[0] || {})[:name]
15
+
16
+ assert_equal "Día de la Anexión de Guanacaste", (Holidays.on(Date.civil(2015, 7, 25), [:cr])[0] || {})[:name]
17
+
18
+ assert_equal "Día de la Virgen de los Angeles", (Holidays.on(Date.civil(2015, 8, 2), [:cr])[0] || {})[:name]
19
+
20
+ assert_equal "Día de la Madre", (Holidays.on(Date.civil(2015, 8, 15), [:cr])[0] || {})[:name]
21
+
22
+ assert_equal "Día de la Independencia", (Holidays.on(Date.civil(2015, 9, 15), [:cr])[0] || {})[:name]
23
+
24
+ assert_equal "Día de las Culturas", (Holidays.on(Date.civil(2015, 10, 12), [:cr])[0] || {})[:name]
25
+
26
+ assert_equal "Navidad", (Holidays.on(Date.civil(2016, 12, 25), [:cr])[0] || {})[:name]
21
27
 
22
28
  end
23
29
  end
@@ -7,21 +7,31 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class CzDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_cz
10
- {Date.civil(2010,1,1) => 'Den obnovy samostatného českého státu',
11
- Date.civil(2016,3,25) => 'Velký pátek',
12
- Date.civil(2010,4,5) => 'Velikonoční pondělí',
13
- Date.civil(2010,5,1) => 'Svátek práce',
14
- Date.civil(2010,5,8) => 'Den vítězství',
15
- Date.civil(2010,7,5) => 'Den slovanských věrozvěstů Cyrila a Metoděje',
16
- Date.civil(2010,7,6) => 'Den upálení mistra Jana Husa',
17
- Date.civil(2010,9,28) => 'Den české státnosti',
18
- Date.civil(2010,10,28) => 'Den vzniku samostatného československého státu',
19
- Date.civil(2010,11,17) => 'Den boje za svobodu a demokracii',
20
- Date.civil(2010,12,24) => 'Štědrý den',
21
- Date.civil(2010,12,25) => '1. svátek vánoční',
22
- Date.civil(2010,12,26) => '2. svátek vánoční'}.each do |date, name|
23
- assert_equal name, (Holidays.on(date, :cz, :informal)[0] || {})[:name]
24
- end
10
+ assert_equal "Den obnovy samostatného českého státu", (Holidays.on(Date.civil(2010, 1, 1), [:cz], [:informal])[0] || {})[:name]
11
+
12
+ assert_equal "Velký pátek", (Holidays.on(Date.civil(2016, 3, 25), [:cz], [:informal])[0] || {})[:name]
13
+
14
+ assert_equal "Velikonoční pondělí", (Holidays.on(Date.civil(2010, 4, 5), [:cz], [:informal])[0] || {})[:name]
15
+
16
+ assert_equal "Svátek práce", (Holidays.on(Date.civil(2010, 5, 1), [:cz], [:informal])[0] || {})[:name]
17
+
18
+ assert_equal "Den vítězství", (Holidays.on(Date.civil(2010, 5, 8), [:cz], [:informal])[0] || {})[:name]
19
+
20
+ assert_equal "Den slovanských věrozvěstů Cyrila a Metoděje", (Holidays.on(Date.civil(2010, 7, 5), [:cz], [:informal])[0] || {})[:name]
21
+
22
+ assert_equal "Den upálení mistra Jana Husa", (Holidays.on(Date.civil(2010, 7, 6), [:cz], [:informal])[0] || {})[:name]
23
+
24
+ assert_equal "Den české státnosti", (Holidays.on(Date.civil(2010, 9, 28), [:cz], [:informal])[0] || {})[:name]
25
+
26
+ assert_equal "Den vzniku samostatného československého státu", (Holidays.on(Date.civil(2010, 10, 28), [:cz], [:informal])[0] || {})[:name]
27
+
28
+ assert_equal "Den boje za svobodu a demokracii", (Holidays.on(Date.civil(2010, 11, 17), [:cz], [:informal])[0] || {})[:name]
29
+
30
+ assert_equal "Štědrý den", (Holidays.on(Date.civil(2010, 12, 24), [:cz], [:informal])[0] || {})[:name]
31
+
32
+ assert_equal "1. svátek vánoční", (Holidays.on(Date.civil(2010, 12, 25), [:cz], [:informal])[0] || {})[:name]
33
+
34
+ assert_equal "2. svátek vánoční", (Holidays.on(Date.civil(2010, 12, 26), [:cz], [:informal])[0] || {})[:name]
25
35
 
26
36
  end
27
37
  end
@@ -7,80 +7,71 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class DeDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_de
10
- { Date.civil(2009, 1, 1) => 'Neujahrstag',
11
- Date.civil(2009, 4, 10) => 'Karfreitag',
12
- Date.civil(2009, 4, 12) => 'Ostersonntag',
13
- Date.civil(2009, 4, 13) => 'Ostermontag',
14
- Date.civil(2009, 5, 1) => 'Tag der Arbeit',
15
- Date.civil(2009, 5, 21) => 'Christi Himmelfahrt',
16
- Date.civil(2009, 5, 31) => 'Pfingstsonntag',
17
- Date.civil(2009, 6, 1) => 'Pfingstmontag',
18
- Date.civil(2009, 10, 3) => 'Tag der Deutschen Einheit',
19
- Date.civil(2009, 12, 24) => 'Heilig Abend',
20
- Date.civil(2009, 12, 25) => '1. Weihnachtstag',
21
- Date.civil(2009, 12, 26) => '2. Weihnachtstag',
22
- Date.civil(2009, 12, 31) => 'Silvester' }.each do |date, name|
23
- assert_equal name, (Holidays.on(date, :de, :informal)[0] || {})[:name], "Failed on '#{name}' for date '#{date}'"
24
- end
10
+ assert_equal "Neujahrstag", (Holidays.on(Date.civil(2009, 1, 1), [:de], [:informal])[0] || {})[:name]
25
11
 
26
- [:de_bw, :de_by, :de_st, :de_].each do |r|
27
- assert_equal 'Heilige Drei Könige', Holidays.on(Date.civil(2009, 1, 6), r)[0][:name]
28
- end
12
+ assert_equal "Karfreitag", (Holidays.on(Date.civil(2009, 4, 10), [:de], [:informal])[0] || {})[:name]
29
13
 
30
- assert_equal [],Holidays.on(Date.civil(2017, 6, 15), [:de_th, :de_sn])
31
- [:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn_sorbian, :de_th_cath].each do |r|
32
- assert_equal 'Fronleichnam', Holidays.on(Date.civil(2017, 6, 15), r)[0][:name]
33
- end
14
+ assert_equal "Ostersonntag", (Holidays.on(Date.civil(2009, 4, 12), [:de], [:informal])[0] || {})[:name]
34
15
 
35
- assert_equal [], Holidays.on(Date.civil(2017, 8, 15), [:de_by, :de_sn])
36
- [:de_by_cath, :de_by_augsburg, :de_sl].each do |r|
37
- assert_equal 'Mariä Himmelfahrt', Holidays.on(Date.civil(2017, 8, 15), r)[0][:name]
38
- end
16
+ assert_equal "Ostermontag", (Holidays.on(Date.civil(2009, 4, 13), [:de], [:informal])[0] || {})[:name]
39
17
 
40
- [:de_sh, :de_ni, :de_hh, :de_hb, :de_be, :de_bb, :de_mv, :de_sn, :de_st, :de_th, :de_].each do |r|
41
- assert_equal 'Reformationstag', Holidays.on(Date.civil(2017, 10, 31), r)[0][:name]
42
- end
18
+ assert_equal "Tag der Arbeit", (Holidays.on(Date.civil(2009, 5, 1), [:de], [:informal])[0] || {})[:name]
43
19
 
44
- # Free day in schools
45
- [:de_bw].each do |r|
46
- assert_equal 'Reformationstag', Holidays.on(Date.civil(2009, 10, 31), r, :informal)[0][:name]
47
- end
20
+ assert_equal "Christi Himmelfahrt", (Holidays.on(Date.civil(2009, 5, 21), [:de], [:informal])[0] || {})[:name]
48
21
 
49
- # 500 years reformation in 2017
50
- assert_equal 'Reformationstag', Holidays.on(Date.civil(2017, 10, 31), :de)[0][:name]
51
- assert_equal [], Holidays.on(Date.civil(2016, 10, 31), :de), "Reformationstag is not a holiday in 2016 in whole Germany"
52
- assert_equal [], Holidays.on(Date.civil(2018, 10, 31), :de), "Reformationstag is not a holiday in 2018 in whole Germany"
22
+ assert_equal "Pfingstsonntag", (Holidays.on(Date.civil(2009, 5, 31), [:de], [:informal])[0] || {})[:name]
53
23
 
54
- [:de_bw, :de_by, :de_nw, :de_rp, :de_sl, :de_].each do |r|
55
- assert_equal 'Allerheiligen', Holidays.on(Date.civil(2009, 11, 1), r)[0][:name]
56
- end
24
+ assert_equal "Pfingstmontag", (Holidays.on(Date.civil(2009, 6, 1), [:de], [:informal])[0] || {})[:name]
57
25
 
58
- [:de_by_augsburg].each do |r|
59
- assert_equal 'Friedensfest', Holidays.on(Date.civil(2015, 8, 8), r)[0][:name]
60
- end
26
+ assert_equal "Tag der Deutschen Einheit", (Holidays.on(Date.civil(2009, 10, 3), [:de], [:informal])[0] || {})[:name]
61
27
 
62
- [:de,
63
- :de_bw, :de_by, :de_bb, :de_he, :de_mv,
64
- :de_nw, :de_rp, :de_sl, :de_sn, :de_st, :de_th].each do |r|
65
- assert_equal [], Holidays.on(Date.civil(2015, 8, 8), r), "Friedensfest is not a holiday in #{r}"
66
- end
28
+ assert_equal "Heilig Abend", (Holidays.on(Date.civil(2009, 12, 24), [:de], [:informal])[0] || {})[:name]
67
29
 
68
- assert_equal [], Holidays.on(Date.civil(2010, 5, 8), :de), '2010-05-08 is not a holiday in Germany'
30
+ assert_equal "1. Weihnachtstag", (Holidays.on(Date.civil(2009, 12, 25), [:de], [:informal])[0] || {})[:name]
69
31
 
70
- assert_equal [], Holidays.on(Date.civil(2010, 8, 8), :de), '2010-08-08 is not a holiday in Germany'
32
+ assert_equal "2. Weihnachtstag", (Holidays.on(Date.civil(2009, 12, 26), [:de], [:informal])[0] || {})[:name]
71
33
 
72
- # Repentance Day
73
- assert_equal 'Buß- und Bettag', Holidays.on(Date.civil(2004, 11, 17), :de_sn)[0][:name]
74
- assert_equal 'Buß- und Bettag', Holidays.on(Date.civil(2005, 11, 16), :de_sn)[0][:name]
75
- assert_equal 'Buß- und Bettag', Holidays.on(Date.civil(2006, 11, 22), :de_sn)[0][:name]
76
- assert_equal 'Buß- und Bettag', Holidays.on(Date.civil(2009, 11, 18), :de_sn)[0][:name]
34
+ assert_equal "Silvester", (Holidays.on(Date.civil(2009, 12, 31), [:de], [:informal])[0] || {})[:name]
77
35
 
78
- # Carnival
79
- [:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn].each do |r|
80
- assert_equal 'Weiberfastnacht', Holidays.on(Date.civil(2016, 2, 4), r, :informal)[0][:name]
81
- assert_equal 'Rosenmontag', Holidays.on(Date.civil(2016, 2, 8), r, :informal)[0][:name]
82
- assert_equal 'Aschermittwoch', Holidays.on(Date.civil(2016, 2, 10), r, :informal)[0][:name]
83
- end
36
+ assert_equal "Heilige Drei Könige", (Holidays.on(Date.civil(2009, 1, 6), [:de_bw, :de_by, :de_st, :de_])[0] || {})[:name]
37
+
38
+ assert_equal "Fronleichnam", (Holidays.on(Date.civil(2009, 6, 11), [:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn_sorbian, :de_th_cath])[0] || {})[:name]
39
+
40
+ assert_equal "Mariä Himmelfahrt", (Holidays.on(Date.civil(2009, 8, 15), [:de_by, :de_sl, :de_])[0] || {})[:name]
41
+
42
+ assert_equal "Reformationstag", (Holidays.on(Date.civil(2009, 10, 31), [:de_bb, :de_mv, :de_sn, :de_st, :de_th, :de_])[0] || {})[:name]
43
+
44
+ assert_equal "Reformationstag", (Holidays.on(Date.civil(2009, 10, 31), [:de_bw], [:informal])[0] || {})[:name]
45
+
46
+ assert_equal "Reformationstag", (Holidays.on(Date.civil(2017, 10, 31), [:de])[0] || {})[:name]
47
+
48
+ assert_nil (Holidays.on(Date.civil(2016, 10, 31), [:de])[0] || {})[:name]
49
+
50
+ assert_nil (Holidays.on(Date.civil(2018, 10, 31), [:de])[0] || {})[:name]
51
+
52
+ assert_equal "Allerheiligen", (Holidays.on(Date.civil(2009, 11, 1), [:de_bw, :de_by, :de_nw, :de_rp, :de_sl, :de_])[0] || {})[:name]
53
+
54
+ assert_equal "Friedensfest", (Holidays.on(Date.civil(2015, 8, 8), [:de_by_augsburg])[0] || {})[:name]
55
+
56
+ assert_nil (Holidays.on(Date.civil(2015, 8, 8), [:de, :de_bw, :de_by, :de_bb, :de_he, :de_mv, :de_nw, :de_rp, :de_sl, :de_sn, :de_st, :de_th])[0] || {})[:name]
57
+
58
+ assert_nil (Holidays.on(Date.civil(2010, 5, 8), [:de])[0] || {})[:name]
59
+
60
+ assert_nil (Holidays.on(Date.civil(2010, 8, 8), [:de])[0] || {})[:name]
61
+
62
+ assert_equal "Buß- und Bettag", (Holidays.on(Date.civil(2004, 11, 17), [:de_sn])[0] || {})[:name]
63
+
64
+ assert_equal "Buß- und Bettag", (Holidays.on(Date.civil(2005, 11, 16), [:de_sn])[0] || {})[:name]
65
+
66
+ assert_equal "Buß- und Bettag", (Holidays.on(Date.civil(2006, 11, 22), [:de_sn])[0] || {})[:name]
67
+
68
+ assert_equal "Buß- und Bettag", (Holidays.on(Date.civil(2009, 11, 18), [:de_sn])[0] || {})[:name]
69
+
70
+ assert_equal "Weiberfastnacht", (Holidays.on(Date.civil(2016, 2, 4), [:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn], [:informal])[0] || {})[:name]
71
+
72
+ assert_equal "Rosenmontag", (Holidays.on(Date.civil(2016, 2, 8), [:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn], [:informal])[0] || {})[:name]
73
+
74
+ assert_equal "Aschermittwoch", (Holidays.on(Date.civil(2016, 2, 10), [:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn], [:informal])[0] || {})[:name]
84
75
 
85
76
  end
86
77
  end
@@ -7,25 +7,37 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class DkDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_dk
10
- {Date.civil(2007,1,1) => 'Nytårsdag',
11
- Date.civil(2007,2,18) => 'Fastelavn',
12
- Date.civil(2007,4,9) => 'Danmarks besættelse',
13
- Date.civil(2007,4,16) => 'Dronningens fødselsdag',
14
- Date.civil(2007,4,5) => 'Skærtorsdag',
15
- Date.civil(2007,4,6) => 'Langfredag',
16
- Date.civil(2007,4,8) => 'Påskedag',
17
- Date.civil(2007,4,9) => '2. påskedag',
18
- Date.civil(2007,5,1) => 'Arbejdernes kampdag',
19
- Date.civil(2007,5,4) => 'Store Bededag',
20
- Date.civil(2007,5,17) => 'Kristi Himmelfartsdag',
21
- Date.civil(2007,5,27) => 'Pinsedag',
22
- Date.civil(2007,5,28) => '2. Pinsedag',
23
- Date.civil(2007,6,5) => 'Grundlovsdag',
24
- Date.civil(2007,12,24) => 'Juleaftensdag',
25
- Date.civil(2007,12,25) => '1. juledag',
26
- Date.civil(2007,12,26) => '2. juledag'}.each do |date, name|
27
- assert_equal name, (Holidays.on(date, :dk, :informal)[0] || {})[:name]
28
- end
10
+ assert_equal "Nytårsdag", (Holidays.on(Date.civil(2007, 1, 1), [:dk], [:informal])[0] || {})[:name]
11
+
12
+ assert_equal "Fastelavn", (Holidays.on(Date.civil(2007, 2, 18), [:dk], [:informal])[0] || {})[:name]
13
+
14
+ assert_equal "2. påskedag", (Holidays.on(Date.civil(2007, 4, 9), [:dk], [:informal])[0] || {})[:name]
15
+
16
+ assert_equal "Dronningens fødselsdag", (Holidays.on(Date.civil(2007, 4, 16), [:dk], [:informal])[0] || {})[:name]
17
+
18
+ assert_equal "Skærtorsdag", (Holidays.on(Date.civil(2007, 4, 5), [:dk], [:informal])[0] || {})[:name]
19
+
20
+ assert_equal "Langfredag", (Holidays.on(Date.civil(2007, 4, 6), [:dk], [:informal])[0] || {})[:name]
21
+
22
+ assert_equal "Påskedag", (Holidays.on(Date.civil(2007, 4, 8), [:dk], [:informal])[0] || {})[:name]
23
+
24
+ assert_equal "Arbejdernes kampdag", (Holidays.on(Date.civil(2007, 5, 1), [:dk], [:informal])[0] || {})[:name]
25
+
26
+ assert_equal "Store Bededag", (Holidays.on(Date.civil(2007, 5, 4), [:dk], [:informal])[0] || {})[:name]
27
+
28
+ assert_equal "Kristi Himmelfartsdag", (Holidays.on(Date.civil(2007, 5, 17), [:dk], [:informal])[0] || {})[:name]
29
+
30
+ assert_equal "Pinsedag", (Holidays.on(Date.civil(2007, 5, 27), [:dk], [:informal])[0] || {})[:name]
31
+
32
+ assert_equal "2. Pinsedag", (Holidays.on(Date.civil(2007, 5, 28), [:dk], [:informal])[0] || {})[:name]
33
+
34
+ assert_equal "Grundlovsdag", (Holidays.on(Date.civil(2007, 6, 5), [:dk], [:informal])[0] || {})[:name]
35
+
36
+ assert_equal "Juleaftensdag", (Holidays.on(Date.civil(2007, 12, 24), [:dk], [:informal])[0] || {})[:name]
37
+
38
+ assert_equal "1. juledag", (Holidays.on(Date.civil(2007, 12, 25), [:dk], [:informal])[0] || {})[:name]
39
+
40
+ assert_equal "2. juledag", (Holidays.on(Date.civil(2007, 12, 26), [:dk], [:informal])[0] || {})[:name]
29
41
 
30
42
  end
31
43
  end
@@ -7,17 +7,21 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class Ecb_targetDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_ecb_target
10
- {Date.civil(2013,1,1) => 'New Year\'s Day',
11
- Date.civil(2013,5,1) => 'Labour Day',
12
- Date.civil(2013,3,29) => 'Good Friday',
13
- Date.civil(2013,4,1) => 'Easter Monday',
14
- Date.civil(2013,12,25) => 'Christmas Day',
15
- Date.civil(2013,12,26) => 'Christmas Holiday'}.each do |date, name|
16
- assert_equal name, (Holidays.on(date, :ecb_target)[0] || {})[:name]
17
- end
10
+ assert_equal "New Year's Day", (Holidays.on(Date.civil(2013, 1, 1), [:ecb_target])[0] || {})[:name]
11
+
12
+ assert_equal "Labour Day", (Holidays.on(Date.civil(2013, 5, 1), [:ecb_target])[0] || {})[:name]
13
+
14
+ assert_equal "Good Friday", (Holidays.on(Date.civil(2013, 3, 29), [:ecb_target])[0] || {})[:name]
15
+
16
+ assert_equal "Easter Monday", (Holidays.on(Date.civil(2013, 4, 1), [:ecb_target])[0] || {})[:name]
17
+
18
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2013, 12, 25), [:ecb_target])[0] || {})[:name]
19
+
20
+ assert_equal "Christmas Holiday", (Holidays.on(Date.civil(2013, 12, 26), [:ecb_target])[0] || {})[:name]
21
+
22
+ assert_equal "Good Friday", (Holidays.on(Date.civil(2013, 3, 29), [:ecb_target])[0] || {})[:name]
18
23
 
19
- assert_equal 'Good Friday', Holidays.on(Date.civil(2013,3,29), :ecb_target)[0][:name]
20
- assert_equal 'Easter Monday', Holidays.on(Date.civil(2013,4,1), :ecb_target)[0][:name]
24
+ assert_equal "Easter Monday", (Holidays.on(Date.civil(2013, 4, 1), [:ecb_target])[0] || {})[:name]
21
25
 
22
26
  end
23
27
  end