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,63 +7,105 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class Federal_reserveDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_federal_reserve
10
- {Date.civil(2012,1,2) => "New Year's Day",
11
- Date.civil(2012,1,16) => "Birthday of Martin Luther King, Jr",
12
- Date.civil(2012,2,20) => "Washington's Birthday",
13
- Date.civil(2012,5,28) => "Memorial Day",
14
- Date.civil(2012,7,4) => "Independence Day",
15
- Date.civil(2012,9,3) => "Labor Day",
16
- Date.civil(2012,10,8) => "Columbus Day",
17
- Date.civil(2012,11,12) => "Veterans Day",
18
- Date.civil(2012,11,22) => "Thanksgiving Day",
19
- Date.civil(2012,12,25) => "Christmas Day",
20
-
21
- Date.civil(2013,1,1) => "New Year's Day",
22
- Date.civil(2013,1,21) => "Birthday of Martin Luther King, Jr",
23
- Date.civil(2013,2,18) => "Washington's Birthday",
24
- Date.civil(2013,5,27) => "Memorial Day",
25
- Date.civil(2013,7,4) => "Independence Day",
26
- Date.civil(2013,9,2) => "Labor Day",
27
- Date.civil(2013,10,14) => "Columbus Day",
28
- Date.civil(2013,11,11) => "Veterans Day",
29
- Date.civil(2013,11,28) => "Thanksgiving Day",
30
- Date.civil(2013,12,25) => "Christmas Day",
31
-
32
- Date.civil(2014,1,1) => "New Year's Day",
33
- Date.civil(2014,1,20) => "Birthday of Martin Luther King, Jr",
34
- Date.civil(2014,2,17) => "Washington's Birthday",
35
- Date.civil(2014,5,26) => "Memorial Day",
36
- Date.civil(2014,7,4) => "Independence Day",
37
- Date.civil(2014,9,1) => "Labor Day",
38
- Date.civil(2014,10,13) => "Columbus Day",
39
- Date.civil(2014,11,11) => "Veterans Day",
40
- Date.civil(2014,11,27) => "Thanksgiving Day",
41
- Date.civil(2014,12,25) => "Christmas Day",
42
-
43
- Date.civil(2015,1,1) => "New Year's Day",
44
- Date.civil(2015,1,19) => "Birthday of Martin Luther King, Jr",
45
- Date.civil(2015,2,16) => "Washington's Birthday",
46
- Date.civil(2015,5,25) => "Memorial Day",
47
- Date.civil(2015,7,4) => "Independence Day",
48
- Date.civil(2015,9,7) => "Labor Day",
49
- Date.civil(2015,10,12) => "Columbus Day",
50
- Date.civil(2015,11,11) => "Veterans Day",
51
- Date.civil(2015,11,26) => "Thanksgiving Day",
52
- Date.civil(2015,12,25) => "Christmas Day",
53
-
54
- Date.civil(2016,1,1) => "New Year's Day",
55
- Date.civil(2016,1,18) => "Birthday of Martin Luther King, Jr",
56
- Date.civil(2016,2,15) => "Washington's Birthday",
57
- Date.civil(2016,5,30) => "Memorial Day",
58
- Date.civil(2016,7,4) => "Independence Day",
59
- Date.civil(2016,9,5) => "Labor Day",
60
- Date.civil(2016,10,10) => "Columbus Day",
61
- Date.civil(2016,11,11) => "Veterans Day",
62
- Date.civil(2016,11,24) => "Thanksgiving Day",
63
- Date.civil(2016,12,26) => "Christmas Day",
64
- }.each do |date, name|
65
- assert_equal name, (Holidays.on(date, :federal_reserve, :observed)[0] || {})[:name]
66
- end
10
+ assert_equal "New Year's Day", (Holidays.on(Date.civil(2012, 1, 2), [:federal_reserve], [:observed])[0] || {})[:name]
11
+
12
+ assert_equal "Birthday of Martin Luther King, Jr", (Holidays.on(Date.civil(2012, 1, 16), [:federal_reserve], [:observed])[0] || {})[:name]
13
+
14
+ assert_equal "Washington's Birthday", (Holidays.on(Date.civil(2012, 2, 20), [:federal_reserve], [:observed])[0] || {})[:name]
15
+
16
+ assert_equal "Memorial Day", (Holidays.on(Date.civil(2012, 5, 28), [:federal_reserve], [:observed])[0] || {})[:name]
17
+
18
+ assert_equal "Independence Day", (Holidays.on(Date.civil(2012, 7, 4), [:federal_reserve], [:observed])[0] || {})[:name]
19
+
20
+ assert_equal "Labor Day", (Holidays.on(Date.civil(2012, 9, 3), [:federal_reserve], [:observed])[0] || {})[:name]
21
+
22
+ assert_equal "Columbus Day", (Holidays.on(Date.civil(2012, 10, 8), [:federal_reserve], [:observed])[0] || {})[:name]
23
+
24
+ assert_equal "Veterans Day", (Holidays.on(Date.civil(2012, 11, 12), [:federal_reserve], [:observed])[0] || {})[:name]
25
+
26
+ assert_equal "Thanksgiving Day", (Holidays.on(Date.civil(2012, 11, 22), [:federal_reserve], [:observed])[0] || {})[:name]
27
+
28
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2012, 12, 25), [:federal_reserve], [:observed])[0] || {})[:name]
29
+
30
+ assert_equal "New Year's Day", (Holidays.on(Date.civil(2013, 1, 1), [:federal_reserve], [:observed])[0] || {})[:name]
31
+
32
+ assert_equal "Birthday of Martin Luther King, Jr", (Holidays.on(Date.civil(2013, 1, 21), [:federal_reserve], [:observed])[0] || {})[:name]
33
+
34
+ assert_equal "Washington's Birthday", (Holidays.on(Date.civil(2013, 2, 18), [:federal_reserve], [:observed])[0] || {})[:name]
35
+
36
+ assert_equal "Memorial Day", (Holidays.on(Date.civil(2013, 5, 27), [:federal_reserve], [:observed])[0] || {})[:name]
37
+
38
+ assert_equal "Independence Day", (Holidays.on(Date.civil(2013, 7, 4), [:federal_reserve], [:observed])[0] || {})[:name]
39
+
40
+ assert_equal "Labor Day", (Holidays.on(Date.civil(2013, 9, 2), [:federal_reserve], [:observed])[0] || {})[:name]
41
+
42
+ assert_equal "Columbus Day", (Holidays.on(Date.civil(2013, 10, 14), [:federal_reserve], [:observed])[0] || {})[:name]
43
+
44
+ assert_equal "Veterans Day", (Holidays.on(Date.civil(2013, 11, 11), [:federal_reserve], [:observed])[0] || {})[:name]
45
+
46
+ assert_equal "Thanksgiving Day", (Holidays.on(Date.civil(2013, 11, 28), [:federal_reserve], [:observed])[0] || {})[:name]
47
+
48
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2013, 12, 25), [:federal_reserve], [:observed])[0] || {})[:name]
49
+
50
+ assert_equal "New Year's Day", (Holidays.on(Date.civil(2014, 1, 1), [:federal_reserve], [:observed])[0] || {})[:name]
51
+
52
+ assert_equal "Birthday of Martin Luther King, Jr", (Holidays.on(Date.civil(2014, 1, 20), [:federal_reserve], [:observed])[0] || {})[:name]
53
+
54
+ assert_equal "Washington's Birthday", (Holidays.on(Date.civil(2014, 2, 17), [:federal_reserve], [:observed])[0] || {})[:name]
55
+
56
+ assert_equal "Memorial Day", (Holidays.on(Date.civil(2014, 5, 26), [:federal_reserve], [:observed])[0] || {})[:name]
57
+
58
+ assert_equal "Independence Day", (Holidays.on(Date.civil(2014, 7, 4), [:federal_reserve], [:observed])[0] || {})[:name]
59
+
60
+ assert_equal "Labor Day", (Holidays.on(Date.civil(2014, 9, 1), [:federal_reserve], [:observed])[0] || {})[:name]
61
+
62
+ assert_equal "Columbus Day", (Holidays.on(Date.civil(2014, 10, 13), [:federal_reserve], [:observed])[0] || {})[:name]
63
+
64
+ assert_equal "Veterans Day", (Holidays.on(Date.civil(2014, 11, 11), [:federal_reserve], [:observed])[0] || {})[:name]
65
+
66
+ assert_equal "Thanksgiving Day", (Holidays.on(Date.civil(2014, 11, 27), [:federal_reserve], [:observed])[0] || {})[:name]
67
+
68
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2014, 12, 25), [:federal_reserve], [:observed])[0] || {})[:name]
69
+
70
+ assert_equal "New Year's Day", (Holidays.on(Date.civil(2015, 1, 1), [:federal_reserve], [:observed])[0] || {})[:name]
71
+
72
+ assert_equal "Birthday of Martin Luther King, Jr", (Holidays.on(Date.civil(2015, 1, 19), [:federal_reserve], [:observed])[0] || {})[:name]
73
+
74
+ assert_equal "Washington's Birthday", (Holidays.on(Date.civil(2015, 2, 16), [:federal_reserve], [:observed])[0] || {})[:name]
75
+
76
+ assert_equal "Memorial Day", (Holidays.on(Date.civil(2015, 5, 25), [:federal_reserve], [:observed])[0] || {})[:name]
77
+
78
+ assert_equal "Independence Day", (Holidays.on(Date.civil(2015, 7, 4), [:federal_reserve], [:observed])[0] || {})[:name]
79
+
80
+ assert_equal "Labor Day", (Holidays.on(Date.civil(2015, 9, 7), [:federal_reserve], [:observed])[0] || {})[:name]
81
+
82
+ assert_equal "Columbus Day", (Holidays.on(Date.civil(2015, 10, 12), [:federal_reserve], [:observed])[0] || {})[:name]
83
+
84
+ assert_equal "Veterans Day", (Holidays.on(Date.civil(2015, 11, 11), [:federal_reserve], [:observed])[0] || {})[:name]
85
+
86
+ assert_equal "Thanksgiving Day", (Holidays.on(Date.civil(2015, 11, 26), [:federal_reserve], [:observed])[0] || {})[:name]
87
+
88
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2015, 12, 25), [:federal_reserve], [:observed])[0] || {})[:name]
89
+
90
+ assert_equal "New Year's Day", (Holidays.on(Date.civil(2016, 1, 1), [:federal_reserve], [:observed])[0] || {})[:name]
91
+
92
+ assert_equal "Birthday of Martin Luther King, Jr", (Holidays.on(Date.civil(2016, 1, 18), [:federal_reserve], [:observed])[0] || {})[:name]
93
+
94
+ assert_equal "Washington's Birthday", (Holidays.on(Date.civil(2016, 2, 15), [:federal_reserve], [:observed])[0] || {})[:name]
95
+
96
+ assert_equal "Memorial Day", (Holidays.on(Date.civil(2016, 5, 30), [:federal_reserve], [:observed])[0] || {})[:name]
97
+
98
+ assert_equal "Independence Day", (Holidays.on(Date.civil(2016, 7, 4), [:federal_reserve], [:observed])[0] || {})[:name]
99
+
100
+ assert_equal "Labor Day", (Holidays.on(Date.civil(2016, 9, 5), [:federal_reserve], [:observed])[0] || {})[:name]
101
+
102
+ assert_equal "Columbus Day", (Holidays.on(Date.civil(2016, 10, 10), [:federal_reserve], [:observed])[0] || {})[:name]
103
+
104
+ assert_equal "Veterans Day", (Holidays.on(Date.civil(2016, 11, 11), [:federal_reserve], [:observed])[0] || {})[:name]
105
+
106
+ assert_equal "Thanksgiving Day", (Holidays.on(Date.civil(2016, 11, 24), [:federal_reserve], [:observed])[0] || {})[:name]
107
+
108
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2016, 12, 26), [:federal_reserve], [:observed])[0] || {})[:name]
67
109
 
68
110
  end
69
111
  end
@@ -7,18 +7,25 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class FedexDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_fedex
10
- {Date.civil(2015,1,1) => 'New Year\'s Day',
11
- Date.civil(2015,5,25) => 'Memorial Day',
12
- Date.civil(2015,7,4) => 'Independence Day',
13
- Date.civil(2015,9,7) => 'Labor Day',
14
- Date.civil(2015,11,26) => 'Thanksgiving',
15
- Date.civil(2015,11,27) => 'Day After Thanksgiving',
16
- Date.civil(2013,11,28) => 'Thanksgiving',
17
- Date.civil(2013,11,29) => 'Day After Thanksgiving',
18
- Date.civil(2015,12,25) => 'Christmas Day',
19
- Date.civil(2015,12,31) => 'New Year\'s Eve',}.each do |date, name|
20
- assert_equal name, (Holidays.on(date, :ups)[0] || {})[:name]
21
- end
10
+ assert_equal "New Year's Day", (Holidays.on(Date.civil(2015, 1, 1), [:ups])[0] || {})[:name]
11
+
12
+ assert_equal "Memorial Day", (Holidays.on(Date.civil(2015, 5, 25), [:ups])[0] || {})[:name]
13
+
14
+ assert_equal "Independence Day", (Holidays.on(Date.civil(2015, 7, 4), [:ups])[0] || {})[:name]
15
+
16
+ assert_equal "Labor Day", (Holidays.on(Date.civil(2015, 9, 7), [:ups])[0] || {})[:name]
17
+
18
+ assert_equal "Thanksgiving", (Holidays.on(Date.civil(2015, 11, 26), [:ups])[0] || {})[:name]
19
+
20
+ assert_equal "Day After Thanksgiving", (Holidays.on(Date.civil(2015, 11, 27), [:ups])[0] || {})[:name]
21
+
22
+ assert_equal "Thanksgiving", (Holidays.on(Date.civil(2013, 11, 28), [:ups])[0] || {})[:name]
23
+
24
+ assert_equal "Day After Thanksgiving", (Holidays.on(Date.civil(2013, 11, 29), [:ups])[0] || {})[:name]
25
+
26
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2015, 12, 25), [:ups])[0] || {})[:name]
27
+
28
+ assert_equal "New Year's Eve", (Holidays.on(Date.civil(2015, 12, 31), [:ups])[0] || {})[:name]
22
29
 
23
30
  end
24
31
  end
@@ -7,33 +7,53 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class FiDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_fi
10
- {Date.civil(2008,1,1) => 'Uudenvuodenpäivä',
11
- Date.civil(2008,1,6) => 'Loppiainen',
12
- Date.civil(2008,3,21) => 'Pitkäperjantai',
13
- Date.civil(2008,3,23) => 'Pääsiäispäivä',
14
- Date.civil(2008,3,24) => '2. Pääsiäispäivä',
15
- Date.civil(2008,5,1) => 'Vappu',
16
- Date.civil(2008,5,1) => 'Helatorstai',
17
- Date.civil(2008,5,11) => 'Helluntaipäivä',
18
- Date.civil(2009,6,19) => 'Juhannusaatto',
19
- Date.civil(2010,6,25) => 'Juhannusaatto',
20
- Date.civil(2011,6,24) => 'Juhannusaatto',
21
- Date.civil(2012,6,22) => 'Juhannusaatto',
22
- Date.civil(2013,6,21) => 'Juhannusaatto',
23
- Date.civil(2005,6,25) => 'Juhannuspäivä',
24
- Date.civil(2006,6,24) => 'Juhannuspäivä',
25
- Date.civil(2007,6,23) => 'Juhannuspäivä',
26
- Date.civil(2008,6,21) => 'Juhannuspäivä',
27
- Date.civil(2005,11,5) => 'Pyhäinpäivä',
28
- Date.civil(2006,11,4) => 'Pyhäinpäivä',
29
- Date.civil(2007,11,3) => 'Pyhäinpäivä',
30
- Date.civil(2008,11,1) => 'Pyhäinpäivä',
31
- Date.civil(2008,12,6) => 'Itsenäisyyspäivä',
32
- Date.civil(2008,12,24) => 'Jouluaatto',
33
- Date.civil(2008,12,25) => 'Joulupäivä',
34
- Date.civil(2008,12,26) => 'Tapaninpäivä'}.each do |date, name|
35
- assert_equal name, (Holidays.on(date, :fi, :informal)[0] || {})[:name]
36
- end
10
+ assert_equal "Uudenvuodenpäivä", (Holidays.on(Date.civil(2008, 1, 1), [:fi], [:informal])[0] || {})[:name]
11
+
12
+ assert_equal "Loppiainen", (Holidays.on(Date.civil(2008, 1, 6), [:fi], [:informal])[0] || {})[:name]
13
+
14
+ assert_equal "Pitkäperjantai", (Holidays.on(Date.civil(2008, 3, 21), [:fi], [:informal])[0] || {})[:name]
15
+
16
+ assert_equal "Pääsiäispäivä", (Holidays.on(Date.civil(2008, 3, 23), [:fi], [:informal])[0] || {})[:name]
17
+
18
+ assert_equal "2. Pääsiäispäivä", (Holidays.on(Date.civil(2008, 3, 24), [:fi], [:informal])[0] || {})[:name]
19
+
20
+ assert_equal "Helatorstai", (Holidays.on(Date.civil(2008, 5, 1), [:fi], [:informal])[0] || {})[:name]
21
+
22
+ assert_equal "Helluntaipäivä", (Holidays.on(Date.civil(2008, 5, 11), [:fi], [:informal])[0] || {})[:name]
23
+
24
+ assert_equal "Juhannusaatto", (Holidays.on(Date.civil(2009, 6, 19), [:fi], [:informal])[0] || {})[:name]
25
+
26
+ assert_equal "Juhannusaatto", (Holidays.on(Date.civil(2010, 6, 25), [:fi], [:informal])[0] || {})[:name]
27
+
28
+ assert_equal "Juhannusaatto", (Holidays.on(Date.civil(2011, 6, 24), [:fi], [:informal])[0] || {})[:name]
29
+
30
+ assert_equal "Juhannusaatto", (Holidays.on(Date.civil(2012, 6, 22), [:fi], [:informal])[0] || {})[:name]
31
+
32
+ assert_equal "Juhannusaatto", (Holidays.on(Date.civil(2013, 6, 21), [:fi], [:informal])[0] || {})[:name]
33
+
34
+ assert_equal "Juhannuspäivä", (Holidays.on(Date.civil(2005, 6, 25), [:fi], [:informal])[0] || {})[:name]
35
+
36
+ assert_equal "Juhannuspäivä", (Holidays.on(Date.civil(2006, 6, 24), [:fi], [:informal])[0] || {})[:name]
37
+
38
+ assert_equal "Juhannuspäivä", (Holidays.on(Date.civil(2007, 6, 23), [:fi], [:informal])[0] || {})[:name]
39
+
40
+ assert_equal "Juhannuspäivä", (Holidays.on(Date.civil(2008, 6, 21), [:fi], [:informal])[0] || {})[:name]
41
+
42
+ assert_equal "Pyhäinpäivä", (Holidays.on(Date.civil(2005, 11, 5), [:fi], [:informal])[0] || {})[:name]
43
+
44
+ assert_equal "Pyhäinpäivä", (Holidays.on(Date.civil(2006, 11, 4), [:fi], [:informal])[0] || {})[:name]
45
+
46
+ assert_equal "Pyhäinpäivä", (Holidays.on(Date.civil(2007, 11, 3), [:fi], [:informal])[0] || {})[:name]
47
+
48
+ assert_equal "Pyhäinpäivä", (Holidays.on(Date.civil(2008, 11, 1), [:fi], [:informal])[0] || {})[:name]
49
+
50
+ assert_equal "Itsenäisyyspäivä", (Holidays.on(Date.civil(2008, 12, 6), [:fi], [:informal])[0] || {})[:name]
51
+
52
+ assert_equal "Jouluaatto", (Holidays.on(Date.civil(2008, 12, 24), [:fi], [:informal])[0] || {})[:name]
53
+
54
+ assert_equal "Joulupäivä", (Holidays.on(Date.civil(2008, 12, 25), [:fi], [:informal])[0] || {})[:name]
55
+
56
+ assert_equal "Tapaninpäivä", (Holidays.on(Date.civil(2008, 12, 26), [:fi], [:informal])[0] || {})[:name]
37
57
 
38
58
  end
39
59
  end
@@ -7,32 +7,37 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class FrDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_fr
10
- { Date.civil(2007, 1, 1) => 'Jour de l\'an',
11
- Date.civil(2007, 4, 9) => 'Lundi de Pâques',
12
- Date.civil(2007, 5, 1) => 'Fête du travail',
13
- Date.civil(2007, 5, 8) => 'Victoire 1945',
14
- Date.civil(2007, 5, 17) => 'Ascension',
15
- Date.civil(2007, 5, 28) => 'Lundi de Pentecôte',
16
- Date.civil(2007, 7, 14) => 'Fête nationale',
17
- Date.civil(2007, 8, 15) => 'Assomption',
18
- Date.civil(2007, 11, 1) => 'Toussaint',
19
- Date.civil(2007, 11, 11) => 'Armistice 1918',
20
- Date.civil(2007, 12, 25) => 'Noël' }.each do |date, name|
21
- assert_equal name, (Holidays.on(date, :fr)[0] || {})[:name]
22
- end
23
- { Date.civil(2007, 4, 8) => 'Pâques',
24
- Date.civil(2007, 5, 27) => 'Pentecôte' }.each do |date, name|
25
- assert_nil (Holidays.on(date, :fr)[0] || {})[:name]
26
- assert_equal name, (Holidays.on(date, :fr, :informal)[0] || {})[:name]
27
- end
10
+ assert_equal "Jour de l'an", (Holidays.on(Date.civil(2007, 1, 1), [:fr])[0] || {})[:name]
28
11
 
29
- [Date.civil(2017, 4, 14), Date.civil(2018, 3, 30), Date.civil(2019, 4, 19)].each do |date|
30
- assert_nil (Holidays.on(date, :fr)[0] || {})[:name]
31
- assert_equal 'Vendredi saint', Holidays.on(date, [:fr_a, :fr_m])[0][:name]
32
- end
12
+ assert_equal "Lundi de Pâques", (Holidays.on(Date.civil(2007, 4, 9), [:fr])[0] || {})[:name]
13
+
14
+ assert_equal "Fête du travail", (Holidays.on(Date.civil(2007, 5, 1), [:fr])[0] || {})[:name]
15
+
16
+ assert_equal "Victoire 1945", (Holidays.on(Date.civil(2007, 5, 8), [:fr])[0] || {})[:name]
17
+
18
+ assert_equal "Ascension", (Holidays.on(Date.civil(2007, 5, 17), [:fr])[0] || {})[:name]
19
+
20
+ assert_equal "Lundi de Pentecôte", (Holidays.on(Date.civil(2007, 5, 28), [:fr])[0] || {})[:name]
21
+
22
+ assert_equal "Fête nationale", (Holidays.on(Date.civil(2007, 7, 14), [:fr])[0] || {})[:name]
23
+
24
+ assert_equal "Assomption", (Holidays.on(Date.civil(2007, 8, 15), [:fr])[0] || {})[:name]
25
+
26
+ assert_equal "Toussaint", (Holidays.on(Date.civil(2007, 11, 1), [:fr])[0] || {})[:name]
27
+
28
+ assert_equal "Armistice 1918", (Holidays.on(Date.civil(2007, 11, 11), [:fr])[0] || {})[:name]
29
+
30
+ assert_equal "Noël", (Holidays.on(Date.civil(2007, 12, 25), [:fr])[0] || {})[:name]
31
+
32
+ assert_nil (Holidays.on(Date.civil(2007, 4, 8), [:fr])[0] || {})[:name]
33
+
34
+ assert_nil (Holidays.on(Date.civil(2007, 5, 27), [:fr])[0] || {})[:name]
35
+
36
+ assert_equal "Pâques", (Holidays.on(Date.civil(2007, 4, 8), [:fr], [:informal])[0] || {})[:name]
37
+
38
+ assert_equal "Pentecôte", (Holidays.on(Date.civil(2007, 5, 27), [:fr], [:informal])[0] || {})[:name]
33
39
 
34
- assert_nil Holidays.on(Date.civil(2017, 12, 26), [:fr])[0] || {}[:name]
35
- assert_equal 'Saint-Étienne', Holidays.on(Date.civil(2017, 12, 26), [:fr_a, :fr_m])[0][:name]
40
+ assert_equal "Saint-Étienne", (Holidays.on(Date.civil(2017, 12, 26), [:fr_a, :fr_m], [:informal])[0] || {})[:name]
36
41
 
37
42
  end
38
43
  end
@@ -7,58 +7,97 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class GbDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_gb
10
- {Date.civil(2008,3,21) => 'Good Friday',
11
- Date.civil(2008,3,23) => 'Easter Sunday',
12
- Date.civil(2008,5,5) => 'May Day',
13
- Date.civil(2008,5,26) => 'Bank Holiday',
14
- Date.civil(2008,11,5) => 'Guy Fawkes Day',
15
- Date.civil(2008,12,25) => 'Christmas Day',
16
- Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
17
- assert_equal name, (Holidays.on(date, :gb, :informal)[0] || {})[:name]
18
- end
10
+ assert_equal "Good Friday", (Holidays.on(Date.civil(2008, 3, 21), [:gb], [:informal])[0] || {})[:name]
19
11
 
20
- assert_equal 'St. Patrick\'s Day', Holidays.on(Date.civil(2008,3,17), :gb_nir, :informal)[0][:name]
21
-
22
- # St. Andrew's Day is informal 2006 and earlier. Should only show up when :informal is passed
23
- assert_equal 'St. Andrew\'s Day', Holidays.on(Date.civil(2006,11,30), :gb_sct, :informal)[0][:name]
24
- assert_equal 'St. Andrew\'s Day', Holidays.on(Date.civil(2006,11,30), :gb_sct, :informal, :observed)[0][:name]
25
- assert_equal 'St. Andrew\'s Day', Holidays.on(Date.civil(2002,12,2), :gb_sct, :informal, :observed)[0][:name]
26
- assert_equal [], Holidays.on(Date.civil(2004,11,30), :gb_sct)
27
- assert_equal [], Holidays.on(Date.civil(2005,11,30), :gb_sct)
28
- assert_equal [], Holidays.on(Date.civil(2006,11,30), :gb_sct)
29
-
30
- # St. Andrew's Day is considered a formal bank holiday 2007 and later. It should show up regardless of whether
31
- # :informal is specified
32
- assert_equal 'St. Andrew\'s Day', Holidays.on(Date.civil(2007,11,30), :gb_sct)[0][:name]
33
- assert_equal 'St. Andrew\'s Day', Holidays.on(Date.civil(2007,11,30), :gb_sct, :informal)[0][:name]
34
- assert_equal 'St. Andrew\'s Day', Holidays.on(Date.civil(2007,11,30), :gb_sct, :informal, :observed)[0][:name]
35
- assert_equal 'St. Andrew\'s Day', Holidays.on(Date.civil(2016,11,30), :gb_sct)[0][:name]
36
- assert_equal 'St. Andrew\'s Day', Holidays.on(Date.civil(2019,11,30), :gb_sct)[0][:name]
37
- assert_equal 'St. Andrew\'s Day', Holidays.on(Date.civil(2019,12,2), :gb_sct, :observed)[0][:name]
38
-
39
- assert_equal 'Christmas Day', Holidays.on(Date.civil(2008,12,25), :gb_, :observed)[0][:name]
40
- assert_equal 'Christmas Day', Holidays.on(Date.civil(2009,12,25), :gb_, :observed)[0][:name]
41
- assert_equal 'Christmas Day', Holidays.on(Date.civil(2010,12,27), :gb_, :observed)[0][:name]
42
-
43
- assert_equal 'Boxing Day', Holidays.on(Date.civil(2008,12,26), :gb_, :observed)[0][:name]
44
- assert_equal 'Boxing Day', Holidays.on(Date.civil(2009,12,28), :gb_, :observed)[0][:name]
45
- assert_equal 'Boxing Day', Holidays.on(Date.civil(2010,12,28), :gb_, :observed)[0][:name]
46
- assert_equal 'Boxing Day', Holidays.on(Date.civil(2011,12,27), :gb_, :observed)[0][:name]
47
-
48
- assert_equal 'New Year\'s Day', Holidays.on(Date.civil(2010,1,1), :gb, :observed)[0][:name]
49
- assert_equal 'New Year\'s Day', Holidays.on(Date.civil(2011,1,3), :gb, :observed)[0][:name]
50
- assert_equal 'New Year\'s Day', Holidays.on(Date.civil(2012,1,2), :gb, :observed)[0][:name]
51
-
52
- assert_equal '2nd January', Holidays.on(Date.civil(2010,1,4), :gb_sct, :observed)[0][:name]
53
- assert_equal '2nd January', Holidays.on(Date.civil(2011,1,4), :gb_sct, :observed)[0][:name]
54
- assert_equal '2nd January', Holidays.on(Date.civil(2012,1,3), :gb_sct, :observed)[0][:name]
55
- assert_equal '2nd January', Holidays.on(Date.civil(2013,1,2), :gb_sct, :observed)[0][:name]
56
- assert_equal '2nd January', Holidays.on(Date.civil(2014,1,2), :gb_sct, :observed)[0][:name]
57
-
58
- [:gb_wls, :gb_eng, :gb_nir, :gb_eaw, :gb_].each do |r|
59
- assert_equal 'Easter Monday', Holidays.on(Date.civil(2008,3,24), r)[0][:name]
60
- assert_equal 'Bank Holiday', Holidays.on(Date.civil(2008,8,25), r)[0][:name]
61
- end
12
+ assert_equal "Easter Sunday", (Holidays.on(Date.civil(2008, 3, 23), [:gb], [:informal])[0] || {})[:name]
13
+
14
+ assert_equal "May Day", (Holidays.on(Date.civil(2008, 5, 5), [:gb], [:informal])[0] || {})[:name]
15
+
16
+ assert_equal "Bank Holiday", (Holidays.on(Date.civil(2008, 5, 26), [:gb], [:informal])[0] || {})[:name]
17
+
18
+ assert_equal "Guy Fawkes Day", (Holidays.on(Date.civil(2008, 11, 5), [:gb], [:informal])[0] || {})[:name]
19
+
20
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2008, 12, 25), [:gb], [:informal])[0] || {})[:name]
21
+
22
+ assert_equal "Boxing Day", (Holidays.on(Date.civil(2008, 12, 26), [:gb], [:informal])[0] || {})[:name]
23
+
24
+ assert_equal "St. Patrick's Day", (Holidays.on(Date.civil(2008, 3, 17), [:gb_nir], [:informal])[0] || {})[:name]
25
+
26
+ assert_equal "St. Andrew's Day", (Holidays.on(Date.civil(2006, 11, 30), [:gb_sct], [:informal])[0] || {})[:name]
27
+
28
+ assert_equal "St. Andrew's Day", (Holidays.on(Date.civil(2006, 11, 30), [:gb_sct], [:informal, :observed])[0] || {})[:name]
29
+
30
+ assert_equal "St. Andrew's Day", (Holidays.on(Date.civil(2002, 12, 2), [:gb_sct], [:informal, :observed])[0] || {})[:name]
31
+
32
+ assert_nil (Holidays.on(Date.civil(2004, 11, 30), [:gb_sct])[0] || {})[:name]
33
+
34
+ assert_nil (Holidays.on(Date.civil(2005, 11, 30), [:gb_sct])[0] || {})[:name]
35
+
36
+ assert_nil (Holidays.on(Date.civil(2006, 11, 30), [:gb_sct])[0] || {})[:name]
37
+
38
+ assert_equal "St. Andrew's Day", (Holidays.on(Date.civil(2007, 11, 30), [:gb_sct])[0] || {})[:name]
39
+
40
+ assert_equal "St. Andrew's Day", (Holidays.on(Date.civil(2007, 11, 30), [:gb_sct], [:informal])[0] || {})[:name]
41
+
42
+ assert_equal "St. Andrew's Day", (Holidays.on(Date.civil(2007, 11, 30), [:gb_sct], [:informal, :observed])[0] || {})[:name]
43
+
44
+ assert_equal "St. Andrew's Day", (Holidays.on(Date.civil(2016, 11, 30), [:gb_sct])[0] || {})[:name]
45
+
46
+ assert_equal "St. Andrew's Day", (Holidays.on(Date.civil(2019, 11, 30), [:gb_sct])[0] || {})[:name]
47
+
48
+ assert_equal "St. Andrew's Day", (Holidays.on(Date.civil(2019, 11, 30), [:gb_sct])[0] || {})[:name]
49
+
50
+ assert_equal "St. Andrew's Day", (Holidays.on(Date.civil(2019, 12, 2), [:gb_sct], [:observed])[0] || {})[:name]
51
+
52
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2008, 12, 25), [:gb_], [:observed])[0] || {})[:name]
53
+
54
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2009, 12, 25), [:gb_], [:observed])[0] || {})[:name]
55
+
56
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2010, 12, 27), [:gb_], [:observed])[0] || {})[:name]
57
+
58
+ assert_equal "Boxing Day", (Holidays.on(Date.civil(2008, 12, 26), [:gb_], [:observed])[0] || {})[:name]
59
+
60
+ assert_equal "Boxing Day", (Holidays.on(Date.civil(2009, 12, 28), [:gb_], [:observed])[0] || {})[:name]
61
+
62
+ assert_equal "Boxing Day", (Holidays.on(Date.civil(2010, 12, 28), [:gb_], [:observed])[0] || {})[:name]
63
+
64
+ assert_equal "Boxing Day", (Holidays.on(Date.civil(2011, 12, 27), [:gb_], [:observed])[0] || {})[:name]
65
+
66
+ assert_equal "New Year's Day", (Holidays.on(Date.civil(2010, 1, 1), [:gb], [:observed])[0] || {})[:name]
67
+
68
+ assert_equal "New Year's Day", (Holidays.on(Date.civil(2011, 1, 3), [:gb], [:observed])[0] || {})[:name]
69
+
70
+ assert_equal "New Year's Day", (Holidays.on(Date.civil(2012, 1, 2), [:gb], [:observed])[0] || {})[:name]
71
+
72
+ assert_equal "2nd January", (Holidays.on(Date.civil(2010, 1, 4), [:gb_sct], [:observed])[0] || {})[:name]
73
+
74
+ assert_equal "2nd January", (Holidays.on(Date.civil(2011, 1, 4), [:gb_sct], [:observed])[0] || {})[:name]
75
+
76
+ assert_equal "2nd January", (Holidays.on(Date.civil(2012, 1, 3), [:gb_sct], [:observed])[0] || {})[:name]
77
+
78
+ assert_equal "2nd January", (Holidays.on(Date.civil(2013, 1, 2), [:gb_sct], [:observed])[0] || {})[:name]
79
+
80
+ assert_equal "2nd January", (Holidays.on(Date.civil(2014, 1, 2), [:gb_sct], [:observed])[0] || {})[:name]
81
+
82
+ assert_equal "Easter Monday", (Holidays.on(Date.civil(2008, 3, 24), [:gb_wls])[0] || {})[:name]
83
+
84
+ assert_equal "Bank Holiday", (Holidays.on(Date.civil(2008, 8, 25), [:gb_wls])[0] || {})[:name]
85
+
86
+ assert_equal "Easter Monday", (Holidays.on(Date.civil(2008, 3, 24), [:gb_eng])[0] || {})[:name]
87
+
88
+ assert_equal "Bank Holiday", (Holidays.on(Date.civil(2008, 8, 25), [:gb_eng])[0] || {})[:name]
89
+
90
+ assert_equal "Easter Monday", (Holidays.on(Date.civil(2008, 3, 24), [:gb_nir])[0] || {})[:name]
91
+
92
+ assert_equal "Bank Holiday", (Holidays.on(Date.civil(2008, 8, 25), [:gb_nir])[0] || {})[:name]
93
+
94
+ assert_equal "Easter Monday", (Holidays.on(Date.civil(2008, 3, 24), [:gb_eaw])[0] || {})[:name]
95
+
96
+ assert_equal "Bank Holiday", (Holidays.on(Date.civil(2008, 8, 25), [:gb_eaw])[0] || {})[:name]
97
+
98
+ assert_equal "Easter Monday", (Holidays.on(Date.civil(2008, 3, 24), [:gb_])[0] || {})[:name]
99
+
100
+ assert_equal "Bank Holiday", (Holidays.on(Date.civil(2008, 8, 25), [:gb_])[0] || {})[:name]
62
101
 
63
102
  end
64
103
  end