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,34 +7,53 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class SeDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_se
10
- {Date.civil(2008,1,1) => 'Nyårsdagen',
11
- Date.civil(2008,1,6) => 'Trettondedag jul',
12
- Date.civil(2008,3,21) => 'Långfredagen',
13
- Date.civil(2008,3,22) => 'Påskafton',
14
- Date.civil(2008,3,23) => 'Påskdagen',
15
- Date.civil(2008,3,24) => 'Annandag påsk',
16
- Date.civil(2008,5,1) => 'Första maj',
17
- Date.civil(2008,5,1) => 'Kristi himmelsfärdsdag',
18
- Date.civil(2008,5,11) => 'Pingstdagen',
19
- Date.civil(2008,6,6) => 'Nationaldagen',
20
- Date.civil(2005,6,25) => 'Midsommardagen',
21
- Date.civil(2006,6,24) => 'Midsommardagen',
22
- Date.civil(2006,6,23) => 'Midsommarafton',
23
- Date.civil(2007,6,23) => 'Midsommardagen',
24
- Date.civil(2007,6,22) => 'Midsommarafton',
25
- Date.civil(2008,6,21) => 'Midsommardagen',
26
- Date.civil(2008,6,20) => 'Midsommarafton',
27
- Date.civil(2005,11,5) => 'Alla helgons dag',
28
- Date.civil(2006,11,4) => 'Alla helgons dag',
29
- Date.civil(2007,11,3) => 'Alla helgons dag',
30
- Date.civil(2008,11,1) => 'Alla helgons dag',
31
- Date.civil(2008,12,24) => 'Julafton',
32
- Date.civil(2008,12,25) => 'Juldagen',
33
- Date.civil(2008,12,26) => 'Annandag jul',
34
- Date.civil(2008,12,31) => 'Nyårsafton'
35
- }.each do |date, name|
36
- assert_equal name, (Holidays.on(date, :se, :informal)[0] || {})[:name]
37
- end
10
+ assert_equal "Nyårsdagen", (Holidays.on(Date.civil(2008, 1, 1), [:se], [:informal])[0] || {})[:name]
11
+
12
+ assert_equal "Trettondedag jul", (Holidays.on(Date.civil(2008, 1, 6), [:se], [:informal])[0] || {})[:name]
13
+
14
+ assert_equal "Långfredagen", (Holidays.on(Date.civil(2008, 3, 21), [:se], [:informal])[0] || {})[:name]
15
+
16
+ assert_equal "Påskafton", (Holidays.on(Date.civil(2008, 3, 22), [:se], [:informal])[0] || {})[:name]
17
+
18
+ assert_equal "Påskdagen", (Holidays.on(Date.civil(2008, 3, 23), [:se], [:informal])[0] || {})[:name]
19
+
20
+ assert_equal "Annandag påsk", (Holidays.on(Date.civil(2008, 3, 24), [:se], [:informal])[0] || {})[:name]
21
+
22
+ assert_equal "Kristi himmelsfärdsdag", (Holidays.on(Date.civil(2008, 5, 1), [:se], [:informal])[0] || {})[:name]
23
+
24
+ assert_equal "Pingstdagen", (Holidays.on(Date.civil(2008, 5, 11), [:se], [:informal])[0] || {})[:name]
25
+
26
+ assert_equal "Nationaldagen", (Holidays.on(Date.civil(2008, 6, 6), [:se], [:informal])[0] || {})[:name]
27
+
28
+ assert_equal "Midsommardagen", (Holidays.on(Date.civil(2005, 6, 25), [:se], [:informal])[0] || {})[:name]
29
+
30
+ assert_equal "Midsommardagen", (Holidays.on(Date.civil(2006, 6, 24), [:se], [:informal])[0] || {})[:name]
31
+
32
+ assert_equal "Midsommarafton", (Holidays.on(Date.civil(2006, 6, 23), [:se], [:informal])[0] || {})[:name]
33
+
34
+ assert_equal "Midsommardagen", (Holidays.on(Date.civil(2007, 6, 23), [:se], [:informal])[0] || {})[:name]
35
+
36
+ assert_equal "Midsommarafton", (Holidays.on(Date.civil(2007, 6, 22), [:se], [:informal])[0] || {})[:name]
37
+
38
+ assert_equal "Midsommardagen", (Holidays.on(Date.civil(2008, 6, 21), [:se], [:informal])[0] || {})[:name]
39
+
40
+ assert_equal "Midsommarafton", (Holidays.on(Date.civil(2008, 6, 20), [:se], [:informal])[0] || {})[:name]
41
+
42
+ assert_equal "Alla helgons dag", (Holidays.on(Date.civil(2005, 11, 5), [:se], [:informal])[0] || {})[:name]
43
+
44
+ assert_equal "Alla helgons dag", (Holidays.on(Date.civil(2006, 11, 4), [:se], [:informal])[0] || {})[:name]
45
+
46
+ assert_equal "Alla helgons dag", (Holidays.on(Date.civil(2007, 11, 3), [:se], [:informal])[0] || {})[:name]
47
+
48
+ assert_equal "Alla helgons dag", (Holidays.on(Date.civil(2008, 11, 1), [:se], [:informal])[0] || {})[:name]
49
+
50
+ assert_equal "Julafton", (Holidays.on(Date.civil(2008, 12, 24), [:se], [:informal])[0] || {})[:name]
51
+
52
+ assert_equal "Juldagen", (Holidays.on(Date.civil(2008, 12, 25), [:se], [:informal])[0] || {})[:name]
53
+
54
+ assert_equal "Annandag jul", (Holidays.on(Date.civil(2008, 12, 26), [:se], [:informal])[0] || {})[:name]
55
+
56
+ assert_equal "Nyårsafton", (Holidays.on(Date.civil(2008, 12, 31), [:se], [:informal])[0] || {})[:name]
38
57
 
39
58
  end
40
59
  end
@@ -7,15 +7,19 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class SgDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_sg
10
- {Date.civil(2014,1,1) => 'New Year\'s Day',
11
- Date.civil(2014,2,14) => 'Valentine\'s Day',
12
- Date.civil(2014,2,15) => 'Total Defence Day',
13
- Date.civil(2014,4,18) => 'Good Friday',
14
- Date.civil(2014,5,1) => 'Labour Day',
15
- Date.civil(2014,8,9) => 'National Day',
16
- Date.civil(2014,12,25) => 'Christmas Day'}.each do |date, name|
17
- assert_equal name, (Holidays.on(date, :sg, :informal)[0] || {})[:name]
18
- end
10
+ assert_equal "New Year's Day", (Holidays.on(Date.civil(2014, 1, 1), [:sg], [:informal])[0] || {})[:name]
11
+
12
+ assert_equal "Valentine's Day", (Holidays.on(Date.civil(2014, 2, 14), [:sg], [:informal])[0] || {})[:name]
13
+
14
+ assert_equal "Total Defence Day", (Holidays.on(Date.civil(2014, 2, 15), [:sg], [:informal])[0] || {})[:name]
15
+
16
+ assert_equal "Good Friday", (Holidays.on(Date.civil(2014, 4, 18), [:sg], [:informal])[0] || {})[:name]
17
+
18
+ assert_equal "Labour Day", (Holidays.on(Date.civil(2014, 5, 1), [:sg], [:informal])[0] || {})[:name]
19
+
20
+ assert_equal "National Day", (Holidays.on(Date.civil(2014, 8, 9), [:sg], [:informal])[0] || {})[:name]
21
+
22
+ assert_equal "Christmas Day", (Holidays.on(Date.civil(2014, 12, 25), [:sg], [:informal])[0] || {})[:name]
19
23
 
20
24
  end
21
25
  end
@@ -7,30 +7,99 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class SiDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_si
10
- assert_equal 'velikonočna nedelja', Holidays.on(Date.civil(2015,4,5), :si)[0][:name]
11
- assert_equal 'velikonočna nedelja', Holidays.on(Date.civil(2016,3,27), :si)[0][:name]
12
-
13
- assert_equal 'velikonočni ponedeljek', Holidays.on(Date.civil(2015,4,6), :si)[0][:name]
14
- assert_equal 'velikonočni ponedeljek', Holidays.on(Date.civil(2016,3,28), :si)[0][:name]
15
-
16
- assert_equal 'binkošti', Holidays.on(Date.civil(2015,5,24), :si)[0][:name]
17
- assert_equal 'binkošti', Holidays.on(Date.civil(2016,5,15), :si)[0][:name]
18
-
19
- (2014..2020).each do |year|
20
- {Date.civil(year,1,1) => 'novo leto',
21
- Date.civil(year,2,8) => 'Prešernov dan, slovenski kulturni praznik',
22
- Date.civil(year,4,27) => 'dan upora proti okupatorju',
23
- Date.civil(year,5,1) => 'praznik dela',
24
- Date.civil(year,5,2) => 'praznik dela',
25
- Date.civil(year,6,25) => 'dan državnosti',
26
- Date.civil(year,8,15) => 'Marijino vnebovzetje',
27
- Date.civil(year,10,31) => 'dan reformacije',
28
- Date.civil(year,11,1) => 'dan spomina na mrtve',
29
- Date.civil(year,12,25) => 'božič',
30
- Date.civil(2008,12,26) => 'dan samostojnosti in enotnosti'}.each do |date, name|
31
- assert_equal name, (Holidays.on(date, :si, :informal)[0] || {})[:name]
32
- end
33
- end
10
+ assert_equal "velikonočna nedelja", (Holidays.on(Date.civil(2015, 4, 5), [:si])[0] || {})[:name]
11
+
12
+ assert_equal "velikonočna nedelja", (Holidays.on(Date.civil(2016, 3, 27), [:si])[0] || {})[:name]
13
+
14
+ assert_equal "velikonočni ponedeljek", (Holidays.on(Date.civil(2015, 4, 6), [:si])[0] || {})[:name]
15
+
16
+ assert_equal "velikonočni ponedeljek", (Holidays.on(Date.civil(2016, 3, 28), [:si])[0] || {})[:name]
17
+
18
+ assert_equal "binkošti", (Holidays.on(Date.civil(2015, 5, 24), [:si])[0] || {})[:name]
19
+
20
+ assert_equal "binkošti", (Holidays.on(Date.civil(2016, 5, 15), [:si])[0] || {})[:name]
21
+
22
+ assert_equal "novo leto", (Holidays.on(Date.civil(2014, 1, 1), [:si], [:informal])[0] || {})[:name]
23
+ assert_equal "novo leto", (Holidays.on(Date.civil(2015, 1, 1), [:si], [:informal])[0] || {})[:name]
24
+ assert_equal "novo leto", (Holidays.on(Date.civil(2016, 1, 1), [:si], [:informal])[0] || {})[:name]
25
+ assert_equal "novo leto", (Holidays.on(Date.civil(2017, 1, 1), [:si], [:informal])[0] || {})[:name]
26
+ assert_equal "novo leto", (Holidays.on(Date.civil(2018, 1, 1), [:si], [:informal])[0] || {})[:name]
27
+ assert_equal "novo leto", (Holidays.on(Date.civil(2019, 1, 1), [:si], [:informal])[0] || {})[:name]
28
+ assert_equal "novo leto", (Holidays.on(Date.civil(2020, 1, 1), [:si], [:informal])[0] || {})[:name]
29
+
30
+ assert_equal "Prešernov dan, slovenski kulturni praznik", (Holidays.on(Date.civil(2014, 2, 8), [:si], [:informal])[0] || {})[:name]
31
+ assert_equal "Prešernov dan, slovenski kulturni praznik", (Holidays.on(Date.civil(2015, 2, 8), [:si], [:informal])[0] || {})[:name]
32
+ assert_equal "Prešernov dan, slovenski kulturni praznik", (Holidays.on(Date.civil(2016, 2, 8), [:si], [:informal])[0] || {})[:name]
33
+ assert_equal "Prešernov dan, slovenski kulturni praznik", (Holidays.on(Date.civil(2017, 2, 8), [:si], [:informal])[0] || {})[:name]
34
+ assert_equal "Prešernov dan, slovenski kulturni praznik", (Holidays.on(Date.civil(2018, 2, 8), [:si], [:informal])[0] || {})[:name]
35
+ assert_equal "Prešernov dan, slovenski kulturni praznik", (Holidays.on(Date.civil(2019, 2, 8), [:si], [:informal])[0] || {})[:name]
36
+ assert_equal "Prešernov dan, slovenski kulturni praznik", (Holidays.on(Date.civil(2020, 2, 8), [:si], [:informal])[0] || {})[:name]
37
+
38
+ assert_equal "dan upora proti okupatorju", (Holidays.on(Date.civil(2014, 4, 27), [:si], [:informal])[0] || {})[:name]
39
+ assert_equal "dan upora proti okupatorju", (Holidays.on(Date.civil(2015, 4, 27), [:si], [:informal])[0] || {})[:name]
40
+ assert_equal "dan upora proti okupatorju", (Holidays.on(Date.civil(2016, 4, 27), [:si], [:informal])[0] || {})[:name]
41
+ assert_equal "dan upora proti okupatorju", (Holidays.on(Date.civil(2017, 4, 27), [:si], [:informal])[0] || {})[:name]
42
+ assert_equal "dan upora proti okupatorju", (Holidays.on(Date.civil(2018, 4, 27), [:si], [:informal])[0] || {})[:name]
43
+ assert_equal "dan upora proti okupatorju", (Holidays.on(Date.civil(2019, 4, 27), [:si], [:informal])[0] || {})[:name]
44
+ assert_equal "dan upora proti okupatorju", (Holidays.on(Date.civil(2020, 4, 27), [:si], [:informal])[0] || {})[:name]
45
+
46
+ assert_equal "praznik dela", (Holidays.on(Date.civil(2014, 5, 1), [:si], [:informal])[0] || {})[:name]
47
+ assert_equal "praznik dela", (Holidays.on(Date.civil(2015, 5, 1), [:si], [:informal])[0] || {})[:name]
48
+ assert_equal "praznik dela", (Holidays.on(Date.civil(2016, 5, 1), [:si], [:informal])[0] || {})[:name]
49
+ assert_equal "praznik dela", (Holidays.on(Date.civil(2017, 5, 1), [:si], [:informal])[0] || {})[:name]
50
+ assert_equal "praznik dela", (Holidays.on(Date.civil(2018, 5, 1), [:si], [:informal])[0] || {})[:name]
51
+ assert_equal "praznik dela", (Holidays.on(Date.civil(2019, 5, 1), [:si], [:informal])[0] || {})[:name]
52
+ assert_equal "praznik dela", (Holidays.on(Date.civil(2020, 5, 1), [:si], [:informal])[0] || {})[:name]
53
+
54
+ assert_equal "praznik dela", (Holidays.on(Date.civil(2014, 5, 2), [:si], [:informal])[0] || {})[:name]
55
+ assert_equal "praznik dela", (Holidays.on(Date.civil(2015, 5, 2), [:si], [:informal])[0] || {})[:name]
56
+ assert_equal "praznik dela", (Holidays.on(Date.civil(2016, 5, 2), [:si], [:informal])[0] || {})[:name]
57
+ assert_equal "praznik dela", (Holidays.on(Date.civil(2017, 5, 2), [:si], [:informal])[0] || {})[:name]
58
+ assert_equal "praznik dela", (Holidays.on(Date.civil(2018, 5, 2), [:si], [:informal])[0] || {})[:name]
59
+ assert_equal "praznik dela", (Holidays.on(Date.civil(2019, 5, 2), [:si], [:informal])[0] || {})[:name]
60
+ assert_equal "praznik dela", (Holidays.on(Date.civil(2020, 5, 2), [:si], [:informal])[0] || {})[:name]
61
+
62
+ assert_equal "dan državnosti", (Holidays.on(Date.civil(2014, 6, 25), [:si], [:informal])[0] || {})[:name]
63
+ assert_equal "dan državnosti", (Holidays.on(Date.civil(2015, 6, 25), [:si], [:informal])[0] || {})[:name]
64
+ assert_equal "dan državnosti", (Holidays.on(Date.civil(2016, 6, 25), [:si], [:informal])[0] || {})[:name]
65
+ assert_equal "dan državnosti", (Holidays.on(Date.civil(2017, 6, 25), [:si], [:informal])[0] || {})[:name]
66
+ assert_equal "dan državnosti", (Holidays.on(Date.civil(2018, 6, 25), [:si], [:informal])[0] || {})[:name]
67
+ assert_equal "dan državnosti", (Holidays.on(Date.civil(2019, 6, 25), [:si], [:informal])[0] || {})[:name]
68
+ assert_equal "dan državnosti", (Holidays.on(Date.civil(2020, 6, 25), [:si], [:informal])[0] || {})[:name]
69
+
70
+ assert_equal "Marijino vnebovzetje", (Holidays.on(Date.civil(2014, 8, 15), [:si], [:informal])[0] || {})[:name]
71
+ assert_equal "Marijino vnebovzetje", (Holidays.on(Date.civil(2015, 8, 15), [:si], [:informal])[0] || {})[:name]
72
+ assert_equal "Marijino vnebovzetje", (Holidays.on(Date.civil(2016, 8, 15), [:si], [:informal])[0] || {})[:name]
73
+ assert_equal "Marijino vnebovzetje", (Holidays.on(Date.civil(2017, 8, 15), [:si], [:informal])[0] || {})[:name]
74
+ assert_equal "Marijino vnebovzetje", (Holidays.on(Date.civil(2018, 8, 15), [:si], [:informal])[0] || {})[:name]
75
+ assert_equal "Marijino vnebovzetje", (Holidays.on(Date.civil(2019, 8, 15), [:si], [:informal])[0] || {})[:name]
76
+ assert_equal "Marijino vnebovzetje", (Holidays.on(Date.civil(2020, 8, 15), [:si], [:informal])[0] || {})[:name]
77
+
78
+ assert_equal "dan reformacije", (Holidays.on(Date.civil(2014, 10, 31), [:si], [:informal])[0] || {})[:name]
79
+ assert_equal "dan reformacije", (Holidays.on(Date.civil(2015, 10, 31), [:si], [:informal])[0] || {})[:name]
80
+ assert_equal "dan reformacije", (Holidays.on(Date.civil(2016, 10, 31), [:si], [:informal])[0] || {})[:name]
81
+ assert_equal "dan reformacije", (Holidays.on(Date.civil(2017, 10, 31), [:si], [:informal])[0] || {})[:name]
82
+ assert_equal "dan reformacije", (Holidays.on(Date.civil(2018, 10, 31), [:si], [:informal])[0] || {})[:name]
83
+ assert_equal "dan reformacije", (Holidays.on(Date.civil(2019, 10, 31), [:si], [:informal])[0] || {})[:name]
84
+ assert_equal "dan reformacije", (Holidays.on(Date.civil(2020, 10, 31), [:si], [:informal])[0] || {})[:name]
85
+
86
+ assert_equal "dan spomina na mrtve", (Holidays.on(Date.civil(2014, 11, 1), [:si], [:informal])[0] || {})[:name]
87
+ assert_equal "dan spomina na mrtve", (Holidays.on(Date.civil(2015, 11, 1), [:si], [:informal])[0] || {})[:name]
88
+ assert_equal "dan spomina na mrtve", (Holidays.on(Date.civil(2016, 11, 1), [:si], [:informal])[0] || {})[:name]
89
+ assert_equal "dan spomina na mrtve", (Holidays.on(Date.civil(2017, 11, 1), [:si], [:informal])[0] || {})[:name]
90
+ assert_equal "dan spomina na mrtve", (Holidays.on(Date.civil(2018, 11, 1), [:si], [:informal])[0] || {})[:name]
91
+ assert_equal "dan spomina na mrtve", (Holidays.on(Date.civil(2019, 11, 1), [:si], [:informal])[0] || {})[:name]
92
+ assert_equal "dan spomina na mrtve", (Holidays.on(Date.civil(2020, 11, 1), [:si], [:informal])[0] || {})[:name]
93
+
94
+ assert_equal "božič", (Holidays.on(Date.civil(2014, 12, 25), [:si], [:informal])[0] || {})[:name]
95
+ assert_equal "božič", (Holidays.on(Date.civil(2015, 12, 25), [:si], [:informal])[0] || {})[:name]
96
+ assert_equal "božič", (Holidays.on(Date.civil(2016, 12, 25), [:si], [:informal])[0] || {})[:name]
97
+ assert_equal "božič", (Holidays.on(Date.civil(2017, 12, 25), [:si], [:informal])[0] || {})[:name]
98
+ assert_equal "božič", (Holidays.on(Date.civil(2018, 12, 25), [:si], [:informal])[0] || {})[:name]
99
+ assert_equal "božič", (Holidays.on(Date.civil(2019, 12, 25), [:si], [:informal])[0] || {})[:name]
100
+ assert_equal "božič", (Holidays.on(Date.civil(2020, 12, 25), [:si], [:informal])[0] || {})[:name]
101
+
102
+ assert_equal "dan samostojnosti in enotnosti", (Holidays.on(Date.civil(2008, 12, 26), [:si], [:informal])[0] || {})[:name]
34
103
 
35
104
  end
36
105
  end
@@ -7,23 +7,35 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class SkDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_sk
10
- {Date.civil(2013,1,1) => 'Nový rok',
11
- Date.civil(2013,1,6) => 'Zjavenie Pána (Traja králi)',
12
- Date.civil(2013,3,29) => 'Veľký piatok',
13
- Date.civil(2013,4,1) => 'Veľkonočný pondelok',
14
- Date.civil(2013,5,1) => 'Sviatok práce',
15
- Date.civil(2013,5,8) => 'Deň víťazstva nad fašizmom',
16
- Date.civil(2013,7,5) => 'Sviatok svätého Cyrila a svätého Metoda',
17
- Date.civil(2013,8,29) => 'Výročie Slovenského národného povstania',
18
- Date.civil(2013,9,1) => 'Deň Ústavy Slovenskej republiky',
19
- Date.civil(2013,9,15) => 'Sedembolestná Panna Mária',
20
- Date.civil(2013,11,1) => 'Sviatok všetkých svätých',
21
- Date.civil(2013,11,17) => 'Deň boja za slobodu a demokraciu',
22
- Date.civil(2013,12,24) => 'Štedrý deň',
23
- Date.civil(2013,12,25) => '1. sviatok vianočný',
24
- Date.civil(2013,12,26) => '2. sviatok vianočný'}.each do |date, name|
25
- assert_equal name, (Holidays.on(date, :sk, :informal)[0] || {})[:name]
26
- end
10
+ assert_equal "Nový rok", (Holidays.on(Date.civil(2013, 1, 1), [:sk], [:informal])[0] || {})[:name]
11
+
12
+ assert_equal "Zjavenie Pána (Traja králi)", (Holidays.on(Date.civil(2013, 1, 6), [:sk], [:informal])[0] || {})[:name]
13
+
14
+ assert_equal "Veľký piatok", (Holidays.on(Date.civil(2013, 3, 29), [:sk], [:informal])[0] || {})[:name]
15
+
16
+ assert_equal "Veľkonočný pondelok", (Holidays.on(Date.civil(2013, 4, 1), [:sk], [:informal])[0] || {})[:name]
17
+
18
+ assert_equal "Sviatok práce", (Holidays.on(Date.civil(2013, 5, 1), [:sk], [:informal])[0] || {})[:name]
19
+
20
+ assert_equal "Deň víťazstva nad fašizmom", (Holidays.on(Date.civil(2013, 5, 8), [:sk], [:informal])[0] || {})[:name]
21
+
22
+ assert_equal "Sviatok svätého Cyrila a svätého Metoda", (Holidays.on(Date.civil(2013, 7, 5), [:sk], [:informal])[0] || {})[:name]
23
+
24
+ assert_equal "Výročie Slovenského národného povstania", (Holidays.on(Date.civil(2013, 8, 29), [:sk], [:informal])[0] || {})[:name]
25
+
26
+ assert_equal "Deň Ústavy Slovenskej republiky", (Holidays.on(Date.civil(2013, 9, 1), [:sk], [:informal])[0] || {})[:name]
27
+
28
+ assert_equal "Sedembolestná Panna Mária", (Holidays.on(Date.civil(2013, 9, 15), [:sk], [:informal])[0] || {})[:name]
29
+
30
+ assert_equal "Sviatok všetkých svätých", (Holidays.on(Date.civil(2013, 11, 1), [:sk], [:informal])[0] || {})[:name]
31
+
32
+ assert_equal "Deň boja za slobodu a demokraciu", (Holidays.on(Date.civil(2013, 11, 17), [:sk], [:informal])[0] || {})[:name]
33
+
34
+ assert_equal "Štedrý deň", (Holidays.on(Date.civil(2013, 12, 24), [:sk], [:informal])[0] || {})[:name]
35
+
36
+ assert_equal "1. sviatok vianočný", (Holidays.on(Date.civil(2013, 12, 25), [:sk], [:informal])[0] || {})[:name]
37
+
38
+ assert_equal "2. sviatok vianočný", (Holidays.on(Date.civil(2013, 12, 26), [:sk], [:informal])[0] || {})[:name]
27
39
 
28
40
  end
29
41
  end
@@ -7,16 +7,21 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class TnDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_tn
10
- {Date.civil(2016,1,1) => "Jour de l'an",
11
- Date.civil(2016,1,14) => "Fête de la Révolution et de la Jeunesse",
12
- Date.civil(2016,3,20) => "Fête de l'Indépendance",
13
- Date.civil(2016,4,9) => "Journée des Martyrs",
14
- Date.civil(2016,5,1) => "Fête du travail",
15
- Date.civil(2016,7,25) => "Fête de la République",
16
- Date.civil(2016,8,13) => "Fête de la Femme et de la Famille",
17
- Date.civil(2016,10,15) => "Fête de l'Évacuation" }.each do |date, name|
18
- assert_equal name, (Holidays.on(date, :tn)[0] || {})[:name]
19
- end
10
+ assert_equal "Jour de l'an", (Holidays.on(Date.civil(2016, 1, 1), [:tn])[0] || {})[:name]
11
+
12
+ assert_equal "Fête de la Révolution et de la Jeunesse", (Holidays.on(Date.civil(2016, 1, 14), [:tn])[0] || {})[:name]
13
+
14
+ assert_equal "Fête de l'Indépendance", (Holidays.on(Date.civil(2016, 3, 20), [:tn])[0] || {})[:name]
15
+
16
+ assert_equal "Journée des Martyrs", (Holidays.on(Date.civil(2016, 4, 9), [:tn])[0] || {})[:name]
17
+
18
+ assert_equal "Fête du travail", (Holidays.on(Date.civil(2016, 5, 1), [:tn])[0] || {})[:name]
19
+
20
+ assert_equal "Fête de la République", (Holidays.on(Date.civil(2016, 7, 25), [:tn])[0] || {})[:name]
21
+
22
+ assert_equal "Fête de la Femme et de la Famille", (Holidays.on(Date.civil(2016, 8, 13), [:tn])[0] || {})[:name]
23
+
24
+ assert_equal "Fête de l'Évacuation", (Holidays.on(Date.civil(2016, 10, 15), [:tn])[0] || {})[:name]
20
25
 
21
26
  end
22
27
  end
@@ -7,38 +7,47 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class TrDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_tr
10
- { Date.civil(2017, 1, 1) => 'Yılbaşı',
11
- Date.civil(2017, 4, 23) => 'Ulusal Egemenlik ve Çocuk Bayramı',
12
- Date.civil(2017, 5, 1) => 'Emek ve Dayanışma Günü',
13
- Date.civil(2017, 5, 19) => "Atatürk'ü Anma Gençlik ve Spor Bayramı",
14
- Date.civil(2017, 8, 30) => 'Zafer Bayramı',
15
- Date.civil(2017, 10, 29) => 'Cumhuriyet Bayramı'
16
- }.each do |date, name|
17
- assert_equal name, (Holidays.on(date, :tr)[0] || {})[:name]
18
- end
10
+ assert_equal "Yılbaşı", (Holidays.on(Date.civil(2017, 1, 1), [:tr])[0] || {})[:name]
19
11
 
20
- [Date.civil(2017, 6, 25), Date.civil(2018, 6, 15), Date.civil(2019, 6, 4)].each do |date|
21
- assert_equal 'Ramazan Bayramı', Holidays.on(date, :tr)[0][:name]
22
- end
23
- [Date.civil(2017, 6, 26), Date.civil(2018, 6, 16), Date.civil(2019, 6, 5)].each do |date|
24
- assert_equal 'Ramazan Bayramı (ikinci tatil)', Holidays.on(date, :tr)[0][:name]
25
- end
26
- [Date.civil(2017, 6, 27), Date.civil(2018, 6, 17), Date.civil(2019, 6, 6)].each do |date|
27
- assert_equal 'Ramazan Bayramı (üçüncü tatil)', Holidays.on(date, :tr)[0][:name]
28
- end
12
+ assert_equal "Ulusal Egemenlik ve Çocuk Bayramı", (Holidays.on(Date.civil(2017, 4, 23), [:tr])[0] || {})[:name]
29
13
 
30
- [Date.civil(2017, 9, 1), Date.civil(2018, 8, 21), Date.civil(2019, 8, 11)].each do |date|
31
- assert_equal 'Kurban Bayramı', Holidays.on(date, :tr)[0][:name]
32
- end
33
- [Date.civil(2017, 9, 2), Date.civil(2018, 8, 22), Date.civil(2019, 8, 12)].each do |date|
34
- assert_equal 'Kurban Bayramı (ikinci tatil)', Holidays.on(date, :tr)[0][:name]
35
- end
36
- [Date.civil(2017, 9, 3), Date.civil(2018, 8, 23), Date.civil(2019, 8, 13)].each do |date|
37
- assert_equal 'Kurban Bayramı (üçüncü tatil)', Holidays.on(date, :tr)[0][:name]
38
- end
39
- [Date.civil(2017, 9, 4), Date.civil(2018, 8, 24), Date.civil(2019, 8, 14)].each do |date|
40
- assert_equal 'Kurban Bayramı (dördüncü tatil)', Holidays.on(date, :tr)[0][:name]
41
- end
14
+ assert_equal "Emek ve Dayanışma Günü", (Holidays.on(Date.civil(2017, 5, 1), [:tr])[0] || {})[:name]
15
+
16
+ assert_equal "Atatürk'ü Anma Gençlik ve Spor Bayramı", (Holidays.on(Date.civil(2017, 5, 19), [:tr])[0] || {})[:name]
17
+
18
+ assert_equal "Zafer Bayramı", (Holidays.on(Date.civil(2017, 8, 30), [:tr])[0] || {})[:name]
19
+
20
+ assert_equal "Cumhuriyet Bayramı", (Holidays.on(Date.civil(2017, 10, 29), [:tr])[0] || {})[:name]
21
+
22
+ assert_equal "Ramazan Bayramı", (Holidays.on(Date.civil(2017, 6, 25), [:tr])[0] || {})[:name]
23
+ assert_equal "Ramazan Bayramı", (Holidays.on(Date.civil(2018, 6, 15), [:tr])[0] || {})[:name]
24
+ assert_equal "Ramazan Bayramı", (Holidays.on(Date.civil(2019, 6, 4), [:tr])[0] || {})[:name]
25
+
26
+ assert_equal "Ramazan Bayramı (ikinci tatil)", (Holidays.on(Date.civil(2017, 6, 26), [:tr])[0] || {})[:name]
27
+ assert_equal "Ramazan Bayramı (ikinci tatil)", (Holidays.on(Date.civil(2018, 6, 16), [:tr])[0] || {})[:name]
28
+ assert_equal "Ramazan Bayramı (ikinci tatil)", (Holidays.on(Date.civil(2019, 6, 5), [:tr])[0] || {})[:name]
29
+
30
+ assert_equal "Ramazan Bayramı (üçüncü tatil)", (Holidays.on(Date.civil(2017, 6, 27), [:tr])[0] || {})[:name]
31
+ assert_equal "Ramazan Bayramı (üçüncü tatil)", (Holidays.on(Date.civil(2018, 6, 17), [:tr])[0] || {})[:name]
32
+ assert_equal "Ramazan Bayramı (üçüncü tatil)", (Holidays.on(Date.civil(2019, 6, 6), [:tr])[0] || {})[:name]
33
+
34
+ assert_equal "Demokrasi ve Milli Birlik Günü", (Holidays.on(Date.civil(2017, 7, 15), [:tr])[0] || {})[:name]
35
+
36
+ assert_equal "Kurban Bayramı", (Holidays.on(Date.civil(2017, 9, 1), [:tr])[0] || {})[:name]
37
+ assert_equal "Kurban Bayramı", (Holidays.on(Date.civil(2018, 8, 21), [:tr])[0] || {})[:name]
38
+ assert_equal "Kurban Bayramı", (Holidays.on(Date.civil(2019, 8, 11), [:tr])[0] || {})[:name]
39
+
40
+ assert_equal "Kurban Bayramı (ikinci tatil)", (Holidays.on(Date.civil(2017, 9, 2), [:tr])[0] || {})[:name]
41
+ assert_equal "Kurban Bayramı (ikinci tatil)", (Holidays.on(Date.civil(2018, 8, 22), [:tr])[0] || {})[:name]
42
+ assert_equal "Kurban Bayramı (ikinci tatil)", (Holidays.on(Date.civil(2019, 8, 12), [:tr])[0] || {})[:name]
43
+
44
+ assert_equal "Kurban Bayramı (üçüncü tatil)", (Holidays.on(Date.civil(2017, 9, 3), [:tr])[0] || {})[:name]
45
+ assert_equal "Kurban Bayramı (üçüncü tatil)", (Holidays.on(Date.civil(2018, 8, 23), [:tr])[0] || {})[:name]
46
+ assert_equal "Kurban Bayramı (üçüncü tatil)", (Holidays.on(Date.civil(2019, 8, 13), [:tr])[0] || {})[:name]
47
+
48
+ assert_equal "Kurban Bayramı (dördüncü tatil)", (Holidays.on(Date.civil(2017, 9, 4), [:tr])[0] || {})[:name]
49
+ assert_equal "Kurban Bayramı (dördüncü tatil)", (Holidays.on(Date.civil(2018, 8, 24), [:tr])[0] || {})[:name]
50
+ assert_equal "Kurban Bayramı (dördüncü tatil)", (Holidays.on(Date.civil(2019, 8, 14), [:tr])[0] || {})[:name]
42
51
 
43
52
  end
44
53
  end
@@ -7,6 +7,5 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class United_nationsDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_united_nations
10
-
11
10
  end
12
11
  end
@@ -7,18 +7,25 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class UpsDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_ups
10
- {Date.civil(2008,1,1) => 'New Year\'s Day',
11
- Date.civil(2008,5,26) => 'Memorial Day',
12
- Date.civil(2008,7,4) => 'Independence Day',
13
- Date.civil(2008,9,1) => 'Labor Day',
14
- Date.civil(2008,11,27) => 'Thanksgiving',
15
- Date.civil(2008,11,28) => 'Day After Thanksgiving',
16
- Date.civil(2013,11,28) => 'Thanksgiving',
17
- Date.civil(2013,11,29) => 'Day After Thanksgiving',
18
- Date.civil(2008,12,25) => 'Christmas Day',
19
- Date.civil(2008,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(2008, 1, 1), [:ups])[0] || {})[:name]
11
+
12
+ assert_equal "Memorial Day", (Holidays.on(Date.civil(2008, 5, 26), [:ups])[0] || {})[:name]
13
+
14
+ assert_equal "Independence Day", (Holidays.on(Date.civil(2008, 7, 4), [:ups])[0] || {})[:name]
15
+
16
+ assert_equal "Labor Day", (Holidays.on(Date.civil(2008, 9, 1), [:ups])[0] || {})[:name]
17
+
18
+ assert_equal "Thanksgiving", (Holidays.on(Date.civil(2008, 11, 27), [:ups])[0] || {})[:name]
19
+
20
+ assert_equal "Day After Thanksgiving", (Holidays.on(Date.civil(2008, 11, 28), [: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(2008, 12, 25), [:ups])[0] || {})[:name]
27
+
28
+ assert_equal "New Year's Eve", (Holidays.on(Date.civil(2008, 12, 31), [:ups])[0] || {})[:name]
22
29
 
23
30
  end
24
31
  end