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,35 +7,47 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class GeDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_ge
10
- { Date.civil(2017, 1, 1) => 'ახალი წელი',
11
- Date.civil(2017, 1, 2) => 'ბედობა',
12
- Date.civil(2017, 1, 7) => 'ქრისტეშობა',
13
- Date.civil(2017, 1, 19) => 'ნათლისღება',
14
- Date.civil(2017, 3, 3) => 'დედის დღე',
15
- Date.civil(2017, 3, 8) => 'ქალთა საერთაშორისო დღე',
16
- Date.civil(2017, 4, 9) => 'ეროვნული ერთიანობის დღე',
17
- Date.civil(2017, 5, 9) => 'ფაშიზმზე გამარჯვების დღე',
18
- Date.civil(2017, 5, 12) => 'წმინდა მოციქულის ანდრია პირველწოდებულის საქართველოში შემოსვლის დღე',
19
- Date.civil(2017, 5, 26) => 'დამოუკიდებლობის დღე',
20
- Date.civil(2017, 8, 28) => 'მარიამობა',
21
- Date.civil(2017, 10, 14) => 'სვეტიცხოვლობა',
22
- Date.civil(2017, 11, 23) => 'გიორგობა'
23
- }.each do |date, name|
24
- assert_equal name, (Holidays.on(date, :ge)[0] || {})[:name]
25
- end
10
+ assert_equal "ახალი წელი", (Holidays.on(Date.civil(2017, 1, 1), [:ge])[0] || {})[:name]
26
11
 
27
- [Date.civil(2017, 4, 14), Date.civil(2018, 4, 6), Date.civil(2019, 4, 26)].each do |date|
28
- assert_equal 'დიდი პარასკევი', Holidays.on(date, :ge)[0][:name]
29
- end
30
- [Date.civil(2017, 4, 15), Date.civil(2018, 4, 7), Date.civil(2019, 4, 27)].each do |date|
31
- assert_equal 'დიდი შაბათი', Holidays.on(date, :ge)[0][:name]
32
- end
33
- [Date.civil(2017, 4, 16), Date.civil(2018, 4, 8), Date.civil(2019, 4, 28)].each do |date|
34
- assert_equal 'ბრწყინვალე აღდგომის დღე', Holidays.on(date, :ge)[0][:name]
35
- end
36
- [Date.civil(2017, 4, 17), Date.civil(2018, 4, 9), Date.civil(2019, 4, 29)].each do |date|
37
- assert_equal 'მიცვალებულთა', Holidays.on(date, :ge)[0][:name]
38
- end
12
+ assert_equal "ბედობა", (Holidays.on(Date.civil(2017, 1, 2), [:ge])[0] || {})[:name]
13
+
14
+ assert_equal "ქრისტეშობა", (Holidays.on(Date.civil(2017, 1, 7), [:ge])[0] || {})[:name]
15
+
16
+ assert_equal "ნათლისღება", (Holidays.on(Date.civil(2017, 1, 19), [:ge])[0] || {})[:name]
17
+
18
+ assert_equal "დედის დღე", (Holidays.on(Date.civil(2017, 3, 3), [:ge])[0] || {})[:name]
19
+
20
+ assert_equal "ქალთა საერთაშორისო დღე", (Holidays.on(Date.civil(2017, 3, 8), [:ge])[0] || {})[:name]
21
+
22
+ assert_equal "ეროვნული ერთიანობის დღე", (Holidays.on(Date.civil(2017, 4, 9), [:ge])[0] || {})[:name]
23
+
24
+ assert_equal "ფაშიზმზე გამარჯვების დღე", (Holidays.on(Date.civil(2017, 5, 9), [:ge])[0] || {})[:name]
25
+
26
+ assert_equal "წმინდა მოციქულის ანდრია პირველწოდებულის საქართველოში შემოსვლის დღე", (Holidays.on(Date.civil(2017, 5, 12), [:ge])[0] || {})[:name]
27
+
28
+ assert_equal "დამოუკიდებლობის დღე", (Holidays.on(Date.civil(2017, 5, 26), [:ge])[0] || {})[:name]
29
+
30
+ assert_equal "მარიამობა", (Holidays.on(Date.civil(2017, 8, 28), [:ge])[0] || {})[:name]
31
+
32
+ assert_equal "სვეტიცხოვლობა", (Holidays.on(Date.civil(2017, 10, 14), [:ge])[0] || {})[:name]
33
+
34
+ assert_equal "გიორგობა", (Holidays.on(Date.civil(2017, 11, 23), [:ge])[0] || {})[:name]
35
+
36
+ assert_equal "დიდი პარასკევი", (Holidays.on(Date.civil(2017, 4, 14), [:ge])[0] || {})[:name]
37
+ assert_equal "დიდი პარასკევი", (Holidays.on(Date.civil(2018, 4, 6), [:ge])[0] || {})[:name]
38
+ assert_equal "დიდი პარასკევი", (Holidays.on(Date.civil(2019, 4, 26), [:ge])[0] || {})[:name]
39
+
40
+ assert_equal "დიდი შაბათი", (Holidays.on(Date.civil(2017, 4, 15), [:ge])[0] || {})[:name]
41
+ assert_equal "დიდი შაბათი", (Holidays.on(Date.civil(2018, 4, 7), [:ge])[0] || {})[:name]
42
+ assert_equal "დიდი შაბათი", (Holidays.on(Date.civil(2019, 4, 27), [:ge])[0] || {})[:name]
43
+
44
+ assert_equal "ბრწყინვალე აღდგომის დღე", (Holidays.on(Date.civil(2017, 4, 16), [:ge])[0] || {})[:name]
45
+ assert_equal "ბრწყინვალე აღდგომის დღე", (Holidays.on(Date.civil(2018, 4, 8), [:ge])[0] || {})[:name]
46
+ assert_equal "ბრწყინვალე აღდგომის დღე", (Holidays.on(Date.civil(2019, 4, 28), [:ge])[0] || {})[:name]
47
+
48
+ assert_equal "მიცვალებულთა", (Holidays.on(Date.civil(2017, 4, 17), [:ge])[0] || {})[:name]
49
+ assert_equal "მიცვალებულთა", (Holidays.on(Date.civil(2018, 4, 9), [:ge])[0] || {})[:name]
50
+ assert_equal "მიცვალებულთა", (Holidays.on(Date.civil(2019, 4, 29), [:ge])[0] || {})[:name]
39
51
 
40
52
  end
41
53
  end
@@ -7,32 +7,53 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class HkDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_hk
10
- {Date.civil(2016,1,1) => 'New Year\'s Day',
11
- Date.civil(2016,2,8) => 'Lunar New Year\'s Day',
12
- Date.civil(2016,2,9) => 'The second day of Lunar New Year',
13
- Date.civil(2016,2,10) => 'The third day of Lunar New Year',
14
- Date.civil(2016,3,25) => 'Good Friday',
15
- Date.civil(2016,3,26) => 'The day following Good Friday',
16
- Date.civil(2016,3,28) => 'Easter Monday',
17
- Date.civil(2016,5,2) => 'Labour Day',
18
- Date.civil(2016,7,1) => 'Hong Kong Special Administrative Region Establishment Day',
19
- Date.civil(2016,10,1) => 'National Day',
20
- Date.civil(2016,12,26) => 'Christmas Day',
21
- Date.civil(2016,12,27) => 'Boxing Day',
22
- Date.civil(2017,1,2) => 'New Year\'s Day',
23
- Date.civil(2017,1,28) => 'Lunar New Year\'s Day',
24
- Date.civil(2017,1,30) => 'The second day of Lunar New Year',
25
- Date.civil(2017,1,31) => 'The third day of Lunar New Year',
26
- Date.civil(2017,4,14) => 'Good Friday',
27
- Date.civil(2017,4,15) => 'The day following Good Friday',
28
- Date.civil(2017,4,17) => 'Easter Monday',
29
- Date.civil(2017,5,1) => 'Labour Day',
30
- Date.civil(2017,7,1) => 'Hong Kong Special Administrative Region Establishment Day',
31
- Date.civil(2017,10,2) => 'National Day',
32
- Date.civil(2017,12,25) => 'Christmas Day',
33
- Date.civil(2017,12,26) => 'Boxing Day'}.each do |date, name|
34
- assert_equal name, (Holidays.on(date, :hk, :observed)[0] || {})[:name]
35
- end
10
+ assert_equal "New Year's Day", (Holidays.on(Date.civil(2016, 1, 1), [:hk], [:observed])[0] || {})[:name]
11
+
12
+ assert_equal "Lunar New Year's Day", (Holidays.on(Date.civil(2016, 2, 8), [:hk], [:observed])[0] || {})[:name]
13
+
14
+ assert_equal "The second day of Lunar New Year", (Holidays.on(Date.civil(2016, 2, 9), [:hk], [:observed])[0] || {})[:name]
15
+
16
+ assert_equal "The third day of Lunar New Year", (Holidays.on(Date.civil(2016, 2, 10), [:hk], [:observed])[0] || {})[:name]
17
+
18
+ assert_equal "Good Friday", (Holidays.on(Date.civil(2016, 3, 25), [:hk], [:observed])[0] || {})[:name]
19
+
20
+ assert_equal "The day following Good Friday", (Holidays.on(Date.civil(2016, 3, 26), [:hk], [:observed])[0] || {})[:name]
21
+
22
+ assert_equal "Easter Monday", (Holidays.on(Date.civil(2016, 3, 28), [:hk], [:observed])[0] || {})[:name]
23
+
24
+ assert_equal "Labour Day", (Holidays.on(Date.civil(2016, 5, 2), [:hk], [:observed])[0] || {})[:name]
25
+
26
+ assert_equal "Hong Kong Special Administrative Region Establishment Day", (Holidays.on(Date.civil(2016, 7, 1), [:hk], [:observed])[0] || {})[:name]
27
+
28
+ assert_equal "National Day", (Holidays.on(Date.civil(2016, 10, 1), [:hk], [:observed])[0] || {})[:name]
29
+
30
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2016, 12, 26), [:hk], [:observed])[0] || {})[:name]
31
+
32
+ assert_equal "Boxing Day", (Holidays.on(Date.civil(2016, 12, 27), [:hk], [:observed])[0] || {})[:name]
33
+
34
+ assert_equal "New Year's Day", (Holidays.on(Date.civil(2017, 1, 2), [:hk], [:observed])[0] || {})[:name]
35
+
36
+ assert_equal "Lunar New Year's Day", (Holidays.on(Date.civil(2017, 1, 28), [:hk], [:observed])[0] || {})[:name]
37
+
38
+ assert_equal "The second day of Lunar New Year", (Holidays.on(Date.civil(2017, 1, 30), [:hk], [:observed])[0] || {})[:name]
39
+
40
+ assert_equal "The third day of Lunar New Year", (Holidays.on(Date.civil(2017, 1, 31), [:hk], [:observed])[0] || {})[:name]
41
+
42
+ assert_equal "Good Friday", (Holidays.on(Date.civil(2017, 4, 14), [:hk], [:observed])[0] || {})[:name]
43
+
44
+ assert_equal "The day following Good Friday", (Holidays.on(Date.civil(2017, 4, 15), [:hk], [:observed])[0] || {})[:name]
45
+
46
+ assert_equal "Easter Monday", (Holidays.on(Date.civil(2017, 4, 17), [:hk], [:observed])[0] || {})[:name]
47
+
48
+ assert_equal "Labour Day", (Holidays.on(Date.civil(2017, 5, 1), [:hk], [:observed])[0] || {})[:name]
49
+
50
+ assert_equal "Hong Kong Special Administrative Region Establishment Day", (Holidays.on(Date.civil(2017, 7, 1), [:hk], [:observed])[0] || {})[:name]
51
+
52
+ assert_equal "National Day", (Holidays.on(Date.civil(2017, 10, 2), [:hk], [:observed])[0] || {})[:name]
53
+
54
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2017, 12, 25), [:hk], [:observed])[0] || {})[:name]
55
+
56
+ assert_equal "Boxing Day", (Holidays.on(Date.civil(2017, 12, 26), [:hk], [:observed])[0] || {})[:name]
36
57
 
37
58
  end
38
59
  end
@@ -7,25 +7,39 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class HrDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_hr
10
- {Date.civil(2012,1,1) => 'Nova godina',
11
- Date.civil(2012,1,6) => 'Sveta tri kralja',
12
- Date.civil(2012,5,1) => 'Međunarodni praznik rada',
13
- Date.civil(2012,6,22) => 'Dan antifašističke borbe',
14
- Date.civil(2012,6,25) => 'Dan državnosti',
15
- Date.civil(2012,8,5) => 'Dan pobjede i domovinske zahvalnosti i dan hrvatskih branitelja',
16
- Date.civil(2012,8,15) => 'Velika Gospa',
17
- Date.civil(2012,10,8) => 'Dan neovisnosti',
18
- Date.civil(2012,11,1) => 'Dan svih svetih',
19
- Date.civil(2012,12,25) => 'Božić',
20
- Date.civil(2012,12,26) => 'Sveti Stjepan'}.each do |date, name|
21
- assert_equal name, (Holidays.on(date, :hr, :informal)[0] || {})[:name]
22
- end
10
+ assert_equal "Nova godina", (Holidays.on(Date.civil(2012, 1, 1), [:hr], [:informal])[0] || {})[:name]
23
11
 
24
- # Tijelovo
25
- [Date.civil(2008,5,22), Date.civil(2009,6,11), Date.civil(2010,6,3),
26
- Date.civil(2012,6,7), Date.civil(2013,5,30), Date.civil(2014,6,19)].each do |date|
27
- assert_equal 'Tijelovo', Holidays.on(date, :hr)[0][:name]
28
- end
12
+ assert_equal "Sveta tri kralja", (Holidays.on(Date.civil(2012, 1, 6), [:hr], [:informal])[0] || {})[:name]
13
+
14
+ assert_equal "Međunarodni praznik rada", (Holidays.on(Date.civil(2012, 5, 1), [:hr], [:informal])[0] || {})[:name]
15
+
16
+ assert_equal "Dan antifašističke borbe", (Holidays.on(Date.civil(2012, 6, 22), [:hr], [:informal])[0] || {})[:name]
17
+
18
+ assert_equal "Dan državnosti", (Holidays.on(Date.civil(2012, 6, 25), [:hr], [:informal])[0] || {})[:name]
19
+
20
+ assert_equal "Dan pobjede i domovinske zahvalnosti i dan hrvatskih branitelja", (Holidays.on(Date.civil(2012, 8, 5), [:hr], [:informal])[0] || {})[:name]
21
+
22
+ assert_equal "Velika Gospa", (Holidays.on(Date.civil(2012, 8, 15), [:hr], [:informal])[0] || {})[:name]
23
+
24
+ assert_equal "Dan neovisnosti", (Holidays.on(Date.civil(2012, 10, 8), [:hr], [:informal])[0] || {})[:name]
25
+
26
+ assert_equal "Dan svih svetih", (Holidays.on(Date.civil(2012, 11, 1), [:hr], [:informal])[0] || {})[:name]
27
+
28
+ assert_equal "Božić", (Holidays.on(Date.civil(2012, 12, 25), [:hr], [:informal])[0] || {})[:name]
29
+
30
+ assert_equal "Sveti Stjepan", (Holidays.on(Date.civil(2012, 12, 26), [:hr], [:informal])[0] || {})[:name]
31
+
32
+ assert_equal "Tijelovo", (Holidays.on(Date.civil(2008, 5, 22), [:hr])[0] || {})[:name]
33
+
34
+ assert_equal "Tijelovo", (Holidays.on(Date.civil(2009, 6, 11), [:hr])[0] || {})[:name]
35
+
36
+ assert_equal "Tijelovo", (Holidays.on(Date.civil(2010, 6, 3), [:hr])[0] || {})[:name]
37
+
38
+ assert_equal "Tijelovo", (Holidays.on(Date.civil(2012, 6, 7), [:hr])[0] || {})[:name]
39
+
40
+ assert_equal "Tijelovo", (Holidays.on(Date.civil(2013, 5, 30), [:hr])[0] || {})[:name]
41
+
42
+ assert_equal "Tijelovo", (Holidays.on(Date.civil(2014, 6, 19), [:hr])[0] || {})[:name]
29
43
 
30
44
  end
31
45
  end
@@ -7,23 +7,33 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class HuDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_hu
10
- {Date.civil(2012,1,1) => 'Újév',
11
- Date.civil(2011,1,1) => 'Újév',
12
- Date.civil(2012,3,15) => '1848/49-es forradalom és szabadságharc ünnepe',
13
- Date.civil(2011,4,25) => 'Húsvét hétfő',
14
- Date.civil(2012,4,9) => 'Húsvét hétfő',
15
- Date.civil(2012,5,1) => 'A munka ünnepe',
16
- Date.civil(2011,6,13) => 'Pünkösd hétfő',
17
- Date.civil(2012,5,28) => 'Pünkösd hétfő',
18
- Date.civil(2012,8,20) => 'Az államalapítás ünnepe',
19
- Date.civil(2012,10,23) => '1956-os forradalom és szabadságharc ünnepe',
20
- Date.civil(2012,11,1) => 'Mindenszentek',
21
- Date.civil(2012,12,25) => 'Karácsony',
22
- Date.civil(2012,12,26) => 'Karácsony',}.each do |date, name|
23
- assert_equal name, (Holidays.on(date, :hu, :informal)[0] || {})[:name]
24
- end
10
+ assert_equal "Újév", (Holidays.on(Date.civil(2012, 1, 1), [:hu], [:informal])[0] || {})[:name]
11
+
12
+ assert_equal "Újév", (Holidays.on(Date.civil(2011, 1, 1), [:hu], [:informal])[0] || {})[:name]
13
+
14
+ assert_equal "1848/49-es forradalom és szabadságharc ünnepe", (Holidays.on(Date.civil(2012, 3, 15), [:hu], [:informal])[0] || {})[:name]
15
+
16
+ assert_equal "Húsvét hétfő", (Holidays.on(Date.civil(2011, 4, 25), [:hu], [:informal])[0] || {})[:name]
17
+
18
+ assert_equal "Húsvét hétfő", (Holidays.on(Date.civil(2012, 4, 9), [:hu], [:informal])[0] || {})[:name]
19
+
20
+ assert_equal "A munka ünnepe", (Holidays.on(Date.civil(2012, 5, 1), [:hu], [:informal])[0] || {})[:name]
21
+
22
+ assert_equal "Pünkösd hétfő", (Holidays.on(Date.civil(2011, 6, 13), [:hu], [:informal])[0] || {})[:name]
23
+
24
+ assert_equal "Pünkösd hétfő", (Holidays.on(Date.civil(2012, 5, 28), [:hu], [:informal])[0] || {})[:name]
25
+
26
+ assert_equal "Az államalapítás ünnepe", (Holidays.on(Date.civil(2012, 8, 20), [:hu], [:informal])[0] || {})[:name]
27
+
28
+ assert_equal "1956-os forradalom és szabadságharc ünnepe", (Holidays.on(Date.civil(2012, 10, 23), [:hu], [:informal])[0] || {})[:name]
29
+
30
+ assert_equal "Mindenszentek", (Holidays.on(Date.civil(2012, 11, 1), [:hu], [:informal])[0] || {})[:name]
31
+
32
+ assert_equal "Karácsony", (Holidays.on(Date.civil(2012, 12, 25), [:hu], [:informal])[0] || {})[:name]
33
+
34
+ assert_equal "Karácsony", (Holidays.on(Date.civil(2012, 12, 26), [:hu], [:informal])[0] || {})[:name]
25
35
 
26
- assert_equal [], Holidays.on(Date.civil(2012,3,14), :hu), '2012-03-14 is not a holiday in Hungary'
36
+ assert_nil (Holidays.on(Date.civil(2012, 3, 14), [:hu])[0] || {})[:name]
27
37
 
28
38
  end
29
39
  end
@@ -7,31 +7,47 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class IeDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_ie
10
- {Date.civil(2008,1,1) => 'New Year\'s Day',
11
- Date.civil(2008,3,17) => 'St. Patrick\'s Day',
12
- Date.civil(2008,3,24) => 'Easter Monday',
13
- Date.civil(2008,5,5) => 'May Day',
14
- Date.civil(2008,6,2) => 'June Bank Holiday',
15
- Date.civil(2008,8,4) => 'August Bank Holiday',
16
- Date.civil(2008,10,27) => 'October Bank Holiday',
17
- Date.civil(2008,12,25) => 'Christmas Day',
18
- Date.civil(2008,12,26) => 'St. Stephen\'s Day'}.each do |date, name|
19
- assert_equal name, (Holidays.on(date, :ie)[0] || {})[:name]
20
- end
21
- {Date.civil(2012,1,2) => 'New Year\'s Day',
22
- Date.civil(2012,3,19) => 'St. Patrick\'s Day',
23
- Date.civil(2012,4,9) => 'Easter Monday',
24
- Date.civil(2012,5,7) => 'May Day',
25
- Date.civil(2012,6,4) => 'June Bank Holiday',
26
- Date.civil(2012,8,6) => 'August Bank Holiday',
27
- Date.civil(2012,10,29) => 'October Bank Holiday',
28
- Date.civil(2011,12,26) => 'Christmas Day',
29
- Date.civil(2011,12,27) => 'St. Stephen\'s Day',
30
- Date.civil(2012,12,25) => 'Christmas Day',
31
- Date.civil(2012,12,26) => 'St. Stephen\'s Day',
32
- Date.civil(2015,12,28) => 'St. Stephen\'s Day'}.each do |date, name|
33
- assert_equal name, (Holidays.on(date, :ie, :observed)[0] || {})[:name]
34
- end
10
+ assert_equal "New Year's Day", (Holidays.on(Date.civil(2008, 1, 1), [:ie])[0] || {})[:name]
11
+
12
+ assert_equal "St. Patrick's Day", (Holidays.on(Date.civil(2008, 3, 17), [:ie])[0] || {})[:name]
13
+
14
+ assert_equal "Easter Monday", (Holidays.on(Date.civil(2008, 3, 24), [:ie])[0] || {})[:name]
15
+
16
+ assert_equal "May Day", (Holidays.on(Date.civil(2008, 5, 5), [:ie])[0] || {})[:name]
17
+
18
+ assert_equal "June Bank Holiday", (Holidays.on(Date.civil(2008, 6, 2), [:ie])[0] || {})[:name]
19
+
20
+ assert_equal "August Bank Holiday", (Holidays.on(Date.civil(2008, 8, 4), [:ie])[0] || {})[:name]
21
+
22
+ assert_equal "October Bank Holiday", (Holidays.on(Date.civil(2008, 10, 27), [:ie])[0] || {})[:name]
23
+
24
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2008, 12, 25), [:ie])[0] || {})[:name]
25
+
26
+ assert_equal "St. Stephen's Day", (Holidays.on(Date.civil(2008, 12, 26), [:ie])[0] || {})[:name]
27
+
28
+ assert_equal "New Year's Day", (Holidays.on(Date.civil(2012, 1, 2), [:ie], [:observed])[0] || {})[:name]
29
+
30
+ assert_equal "St. Patrick's Day", (Holidays.on(Date.civil(2012, 3, 19), [:ie], [:observed])[0] || {})[:name]
31
+
32
+ assert_equal "Easter Monday", (Holidays.on(Date.civil(2012, 4, 9), [:ie], [:observed])[0] || {})[:name]
33
+
34
+ assert_equal "May Day", (Holidays.on(Date.civil(2012, 5, 7), [:ie], [:observed])[0] || {})[:name]
35
+
36
+ assert_equal "June Bank Holiday", (Holidays.on(Date.civil(2012, 6, 4), [:ie], [:observed])[0] || {})[:name]
37
+
38
+ assert_equal "August Bank Holiday", (Holidays.on(Date.civil(2012, 8, 6), [:ie], [:observed])[0] || {})[:name]
39
+
40
+ assert_equal "October Bank Holiday", (Holidays.on(Date.civil(2012, 10, 29), [:ie], [:observed])[0] || {})[:name]
41
+
42
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2011, 12, 26), [:ie], [:observed])[0] || {})[:name]
43
+
44
+ assert_equal "St. Stephen's Day", (Holidays.on(Date.civil(2011, 12, 27), [:ie], [:observed])[0] || {})[:name]
45
+
46
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2012, 12, 25), [:ie], [:observed])[0] || {})[:name]
47
+
48
+ assert_equal "St. Stephen's Day", (Holidays.on(Date.civil(2012, 12, 26), [:ie], [:observed])[0] || {})[:name]
49
+
50
+ assert_equal "St. Stephen's Day", (Holidays.on(Date.civil(2015, 12, 28), [:ie], [:observed])[0] || {})[:name]
35
51
 
36
52
  end
37
53
  end
@@ -7,28 +7,45 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class IsDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_is
10
- {Date.civil(2007,1,1) => 'Nýársdagur',
11
- Date.civil(2007,1,6) => 'Þrettándinn',
12
- Date.civil(2007,1,19) => 'Bóndadagur',
13
- Date.civil(2007,2,18) => 'Konudagur',
14
- Date.civil(2007,4,5) => 'Skírdagur',
15
- Date.civil(2007,4,6) => 'Föstudaginn langi',
16
- Date.civil(2007,4,8) => 'Páskadagur',
17
- Date.civil(2007,4,9) => 'Annar í páskum',
18
- Date.civil(2007,4,19) => 'Sumardagurinn fyrsti',
19
- Date.civil(2007,5,1) => 'Verkalýðsdagurinn',
20
- Date.civil(2007,5,17) => 'Uppstigningardagur',
21
- Date.civil(2007,5,27) => 'Hvítasunnudagur',
22
- Date.civil(2007,5,28) => 'Annar í hvítasunnu',
23
- Date.civil(2007,6,3) => 'Sjómannadagurinn',
24
- Date.civil(2007,6,17) => 'Lýðveldisdagurinn',
25
- Date.civil(2007,8,6) => 'Frídagur verslunarmanna',
26
- Date.civil(2007,12,24) => 'Jól',
27
- Date.civil(2007,12,25) => 'Jól',
28
- Date.civil(2007,12,26) => 'Jól',
29
- Date.civil(2007,12,31) => 'Gamlárskvöld'}.each do |date, name|
30
- assert_equal name, (Holidays.on(date, :is, :informal)[0] || {})[:name]
31
- end
10
+ assert_equal "Nýársdagur", (Holidays.on(Date.civil(2007, 1, 1), [:is], [:informal])[0] || {})[:name]
11
+
12
+ assert_equal "Þrettándinn", (Holidays.on(Date.civil(2007, 1, 6), [:is], [:informal])[0] || {})[:name]
13
+
14
+ assert_equal "Bóndadagur", (Holidays.on(Date.civil(2007, 1, 19), [:is], [:informal])[0] || {})[:name]
15
+
16
+ assert_equal "Konudagur", (Holidays.on(Date.civil(2007, 2, 18), [:is], [:informal])[0] || {})[:name]
17
+
18
+ assert_equal "Skírdagur", (Holidays.on(Date.civil(2007, 4, 5), [:is], [:informal])[0] || {})[:name]
19
+
20
+ assert_equal "Föstudaginn langi", (Holidays.on(Date.civil(2007, 4, 6), [:is], [:informal])[0] || {})[:name]
21
+
22
+ assert_equal "Páskadagur", (Holidays.on(Date.civil(2007, 4, 8), [:is], [:informal])[0] || {})[:name]
23
+
24
+ assert_equal "Annar í páskum", (Holidays.on(Date.civil(2007, 4, 9), [:is], [:informal])[0] || {})[:name]
25
+
26
+ assert_equal "Sumardagurinn fyrsti", (Holidays.on(Date.civil(2007, 4, 19), [:is], [:informal])[0] || {})[:name]
27
+
28
+ assert_equal "Verkalýðsdagurinn", (Holidays.on(Date.civil(2007, 5, 1), [:is], [:informal])[0] || {})[:name]
29
+
30
+ assert_equal "Uppstigningardagur", (Holidays.on(Date.civil(2007, 5, 17), [:is], [:informal])[0] || {})[:name]
31
+
32
+ assert_equal "Hvítasunnudagur", (Holidays.on(Date.civil(2007, 5, 27), [:is], [:informal])[0] || {})[:name]
33
+
34
+ assert_equal "Annar í hvítasunnu", (Holidays.on(Date.civil(2007, 5, 28), [:is], [:informal])[0] || {})[:name]
35
+
36
+ assert_equal "Sjómannadagurinn", (Holidays.on(Date.civil(2007, 6, 3), [:is], [:informal])[0] || {})[:name]
37
+
38
+ assert_equal "Lýðveldisdagurinn", (Holidays.on(Date.civil(2007, 6, 17), [:is], [:informal])[0] || {})[:name]
39
+
40
+ assert_equal "Frídagur verslunarmanna", (Holidays.on(Date.civil(2007, 8, 6), [:is], [:informal])[0] || {})[:name]
41
+
42
+ assert_equal "Jól", (Holidays.on(Date.civil(2007, 12, 24), [:is], [:informal])[0] || {})[:name]
43
+
44
+ assert_equal "Jól", (Holidays.on(Date.civil(2007, 12, 25), [:is], [:informal])[0] || {})[:name]
45
+
46
+ assert_equal "Jól", (Holidays.on(Date.civil(2007, 12, 26), [:is], [:informal])[0] || {})[:name]
47
+
48
+ assert_equal "Gamlárskvöld", (Holidays.on(Date.civil(2007, 12, 31), [:is], [:informal])[0] || {})[:name]
32
49
 
33
50
  end
34
51
  end
@@ -7,20 +7,29 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class ItDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_it
10
- {Date.civil(2007,1,1) => 'Capodanno',
11
- Date.civil(2007,1,6) => 'Epifania',
12
- Date.civil(2007,4,8) => 'Pasqua',
13
- Date.civil(2007,4,9) => 'Lunedì dell\'Angelo',
14
- Date.civil(2007,4,25) => 'Festa della Liberazione',
15
- Date.civil(2007,5,1) => 'Festa dei Lavoratori',
16
- Date.civil(2007,6,2) => 'Festa della Repubblica',
17
- Date.civil(2007,8,15) => 'Assunzione',
18
- Date.civil(2007,11,1) => 'Ognissanti',
19
- Date.civil(2007,12,8) => 'Immacolata Concezione',
20
- Date.civil(2007,12,25) => 'Natale',
21
- Date.civil(2007,12,26) => 'Santo Stefano'}.each do |date, name|
22
- assert_equal name, (Holidays.on(date, :it, :informal)[0] || {})[:name]
23
- end
10
+ assert_equal "Capodanno", (Holidays.on(Date.civil(2007, 1, 1), [:it], [:informal])[0] || {})[:name]
11
+
12
+ assert_equal "Epifania", (Holidays.on(Date.civil(2007, 1, 6), [:it], [:informal])[0] || {})[:name]
13
+
14
+ assert_equal "Pasqua", (Holidays.on(Date.civil(2007, 4, 8), [:it], [:informal])[0] || {})[:name]
15
+
16
+ assert_equal "Lunedì dell'Angelo", (Holidays.on(Date.civil(2007, 4, 9), [:it], [:informal])[0] || {})[:name]
17
+
18
+ assert_equal "Festa della Liberazione", (Holidays.on(Date.civil(2007, 4, 25), [:it], [:informal])[0] || {})[:name]
19
+
20
+ assert_equal "Festa dei Lavoratori", (Holidays.on(Date.civil(2007, 5, 1), [:it], [:informal])[0] || {})[:name]
21
+
22
+ assert_equal "Festa della Repubblica", (Holidays.on(Date.civil(2007, 6, 2), [:it], [:informal])[0] || {})[:name]
23
+
24
+ assert_equal "Assunzione", (Holidays.on(Date.civil(2007, 8, 15), [:it], [:informal])[0] || {})[:name]
25
+
26
+ assert_equal "Ognissanti", (Holidays.on(Date.civil(2007, 11, 1), [:it], [:informal])[0] || {})[:name]
27
+
28
+ assert_equal "Immacolata Concezione", (Holidays.on(Date.civil(2007, 12, 8), [:it], [:informal])[0] || {})[:name]
29
+
30
+ assert_equal "Natale", (Holidays.on(Date.civil(2007, 12, 25), [:it], [:informal])[0] || {})[:name]
31
+
32
+ assert_equal "Santo Stefano", (Holidays.on(Date.civil(2007, 12, 26), [:it], [:informal])[0] || {})[:name]
24
33
 
25
34
  end
26
35
  end