holidays 1.0.8 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/README.md +19 -0
  4. data/Rakefile +1 -2
  5. data/data/au.yaml +81 -1
  6. data/data/ca.yaml +40 -3
  7. data/data/cr.yaml +63 -0
  8. data/data/federal_reserve.yaml +4 -28
  9. data/data/fedex.yaml +56 -0
  10. data/data/index.yaml +2 -0
  11. data/data/jp.yaml +8 -1
  12. data/lib/holidays.rb +219 -0
  13. data/lib/holidays/MANIFEST +2 -0
  14. data/lib/holidays/ar.rb +1 -1
  15. data/lib/holidays/at.rb +1 -1
  16. data/lib/holidays/au.rb +27 -4
  17. data/lib/holidays/be.rb +1 -1
  18. data/lib/holidays/br.rb +1 -1
  19. data/lib/holidays/ca.rb +6 -3
  20. data/lib/holidays/ch.rb +1 -1
  21. data/lib/holidays/cl.rb +1 -1
  22. data/lib/holidays/cr.rb +39 -0
  23. data/lib/holidays/cz.rb +1 -1
  24. data/lib/holidays/de.rb +2 -2
  25. data/lib/holidays/dk.rb +1 -1
  26. data/lib/holidays/ecb_target.rb +1 -1
  27. data/lib/holidays/el.rb +1 -1
  28. data/lib/holidays/es.rb +1 -1
  29. data/lib/holidays/europe.rb +75 -32
  30. data/lib/holidays/fed_ex.rb +36 -0
  31. data/lib/holidays/federal_reserve.rb +5 -8
  32. data/lib/holidays/fi.rb +1 -1
  33. data/lib/holidays/fr.rb +1 -1
  34. data/lib/holidays/gb.rb +1 -1
  35. data/lib/holidays/hr.rb +1 -1
  36. data/lib/holidays/hu.rb +1 -1
  37. data/lib/holidays/ie.rb +1 -1
  38. data/lib/holidays/is.rb +1 -1
  39. data/lib/holidays/it.rb +1 -1
  40. data/lib/holidays/jp.rb +3 -2
  41. data/lib/holidays/li.rb +1 -1
  42. data/lib/holidays/lt.rb +1 -1
  43. data/lib/holidays/ma.rb +1 -1
  44. data/lib/holidays/mx.rb +1 -1
  45. data/lib/holidays/nerc.rb +1 -1
  46. data/lib/holidays/nl.rb +1 -1
  47. data/lib/holidays/no.rb +1 -1
  48. data/lib/holidays/north_america.rb +8 -5
  49. data/lib/holidays/nyse.rb +1 -1
  50. data/lib/holidays/nz.rb +1 -1
  51. data/lib/holidays/pl.rb +1 -1
  52. data/lib/holidays/pt.rb +1 -1
  53. data/lib/holidays/ro.rb +1 -1
  54. data/lib/holidays/scandinavia.rb +18 -11
  55. data/lib/holidays/se.rb +1 -1
  56. data/lib/holidays/sg.rb +1 -1
  57. data/lib/holidays/si.rb +1 -1
  58. data/lib/holidays/sk.rb +1 -1
  59. data/lib/holidays/united_nations.rb +3 -3
  60. data/lib/holidays/ups.rb +1 -1
  61. data/lib/holidays/us.rb +1 -1
  62. data/lib/holidays/ve.rb +1 -1
  63. data/lib/holidays/version.rb +1 -1
  64. data/lib/holidays/vi.rb +1 -1
  65. data/lib/holidays/za.rb +1 -1
  66. data/test/data/test_custom_govt_holiday_defs.yaml +5 -0
  67. data/test/data/test_multiple_custom_holiday_defs.yaml +9 -0
  68. data/test/data/test_single_custom_holiday_defs.yaml +9 -0
  69. data/test/defs/test_defs_au.rb +32 -0
  70. data/test/defs/test_defs_ca.rb +25 -0
  71. data/test/defs/test_defs_cr.rb +22 -0
  72. data/test/defs/test_defs_de.rb +6 -6
  73. data/test/defs/test_defs_europe.rb +24 -0
  74. data/test/defs/test_defs_fed_ex.rb +21 -0
  75. data/test/defs/test_defs_federal_reserve.rb +2 -15
  76. data/test/defs/test_defs_jp.rb +1 -0
  77. data/test/defs/test_defs_north_america.rb +25 -0
  78. data/test/defs/test_defs_united_nations.rb +12 -0
  79. data/test/test_custom_holidays.rb +35 -0
  80. data/test/test_parse_definitions.rb +24 -0
  81. metadata +22 -3
  82. data/data/build_defs.rb +0 -157
data/lib/holidays/ups.rb CHANGED
@@ -4,7 +4,7 @@ module Holidays
4
4
  #
5
5
  # Definitions loaded: data/ups.yaml
6
6
  #
7
- # To use the definitions in this file, load it right after you load the
7
+ # To use the definitions in this file, load it right after you load the
8
8
  # Holiday gem:
9
9
  #
10
10
  # require 'holidays'
data/lib/holidays/us.rb CHANGED
@@ -4,7 +4,7 @@ module Holidays
4
4
  #
5
5
  # Definitions loaded: data/us.yaml, data/north_america_informal.yaml
6
6
  #
7
- # To use the definitions in this file, load it right after you load the
7
+ # To use the definitions in this file, load it right after you load the
8
8
  # Holiday gem:
9
9
  #
10
10
  # require 'holidays'
data/lib/holidays/ve.rb CHANGED
@@ -4,7 +4,7 @@ module Holidays
4
4
  #
5
5
  # Definitions loaded: data/ve.yaml
6
6
  #
7
- # To use the definitions in this file, load it right after you load the
7
+ # To use the definitions in this file, load it right after you load the
8
8
  # Holiday gem:
9
9
  #
10
10
  # require 'holidays'
@@ -1,3 +1,3 @@
1
1
  module Holidays
2
- VERSION = '1.0.8'
2
+ VERSION = '1.1.0'
3
3
  end
data/lib/holidays/vi.rb CHANGED
@@ -4,7 +4,7 @@ module Holidays
4
4
  #
5
5
  # Definitions loaded: data/vi.yaml
6
6
  #
7
- # To use the definitions in this file, load it right after you load the
7
+ # To use the definitions in this file, load it right after you load the
8
8
  # Holiday gem:
9
9
  #
10
10
  # require 'holidays'
data/lib/holidays/za.rb CHANGED
@@ -4,7 +4,7 @@ module Holidays
4
4
  #
5
5
  # Definitions loaded: data/za.yaml
6
6
  #
7
- # To use the definitions in this file, load it right after you load the
7
+ # To use the definitions in this file, load it right after you load the
8
8
  # Holiday gem:
9
9
  #
10
10
  # require 'holidays'
@@ -0,0 +1,5 @@
1
+ months:
2
+ 3:
3
+ - name: Yaaay Government Day
4
+ regions: [custom_multiple_files, custom_multiple_files_govt]
5
+ mday: 1
@@ -0,0 +1,9 @@
1
+ months:
2
+ 10:
3
+ - name: Company Founding!
4
+ regions: [custom_multiple_files]
5
+ mday: 5
6
+ tests: |
7
+ {Date.civil(2013,10,5) => 'Company Founding!'}.each do |date, name|
8
+ assert_equal name, (Holidays.on(date, :custom_multiple_files)[0] || {})[:name]
9
+ end
@@ -0,0 +1,9 @@
1
+ months:
2
+ 6:
3
+ - name: Company Founding
4
+ regions: [custom_single_file]
5
+ mday: 20
6
+ tests: |
7
+ {Date.civil(2013,6,20) => 'Company Founding'}.each do |date, name|
8
+ assert_equal name, (Holidays.on(date, :custom_single_file)[0] || {})[:name]
9
+ end
@@ -42,8 +42,40 @@ assert_equal "Queen's Birthday", Date.civil(2012,6,11).holidays(:au_qld)[0][:nam
42
42
  assert_equal "Queen's Birthday", Date.civil(2012,10,1).holidays(:au_qld)[0][:name]
43
43
  assert_equal "Queen's Birthday", Date.civil(2013,6,10).holidays(:au_qld)[0][:name]
44
44
 
45
+ assert_equal "Queen's Birthday", Date.civil(2014, 9, 29).holidays(:au_wa)[0][:name]
46
+ assert_equal "Queen's Birthday", Date.civil(2015, 9, 28).holidays(:au_wa)[0][:name]
47
+ assert_equal "Queen's Birthday", Date.civil(2016, 9, 26).holidays(:au_wa)[0][:name]
48
+
49
+ assert_equal "Family & Community Day", Date.civil(2014, 9, 29).holidays(:au_act)[0][:name]
50
+ assert_equal "Family & Community Day", Date.civil(2015, 9, 28).holidays(:au_act)[0][:name]
51
+ assert_equal "Family & Community Day", Date.civil(2016, 9, 26).holidays(:au_act)[0][:name]
52
+
45
53
  assert_equal 'Australia Day', Date.civil(2014,1,26).holidays(:au_qld)[0][:name]
46
54
  assert_equal 'Australia Day', Date.civil(2014,1,27).holidays(:au_qld, :observed)[0][:name]
47
55
 
56
+ assert_equal 'Cairns Show', Date.civil(2014,7,18).holidays(:au_qld_cairns)[0][:name]
57
+ assert_equal 'Cairns Show', Date.civil(2013,7,19).holidays(:au_qld_cairns)[0][:name]
58
+
59
+ assert_equal 'Royal Hobart Show', Date.civil(2013, 10, 24).holidays(:au_tas_south)[0][:name]
60
+ assert_equal 'Royal Hobart Show', Date.civil(2014, 10, 23).holidays(:au_tas_south)[0][:name]
61
+ assert_equal 'Royal Hobart Show', Date.civil(2015, 10, 22).holidays(:au_tas_south)[0][:name]
62
+ assert_equal 'Royal Hobart Show', Date.civil(2016, 10, 20).holidays(:au_tas_south)[0][:name]
63
+
64
+ assert_equal 'Recreation Day', Date.civil(2013, 11, 4).holidays(:au_tas_north)[0][:name]
65
+ assert_equal 'Recreation Day', Date.civil(2014, 11, 3).holidays(:au_tas_north)[0][:name]
66
+ assert_equal 'Recreation Day', Date.civil(2015, 11, 2).holidays(:au_tas_north)[0][:name]
67
+ assert_equal 'Recreation Day', Date.civil(2016, 11, 7).holidays(:au_tas_north)[0][:name]
68
+
69
+ assert_equal 'G20 Day', Date.civil(2014,11,14).holidays(:au_qld_brisbane)[0][:name]
70
+ assert_equal [], Date.civil(2014,11,14).holidays(:au_qld)
71
+ assert_equal [], Date.civil(2015,11,14).holidays(:au_qld_brisbane)
72
+
73
+ assert_equal 'Melbourne Cup Day', Date.civil(2014,11,4).holidays(:au_vic)[0][:name]
74
+ assert_equal 'Melbourne Cup Day', Date.civil(2015,11,3).holidays(:au_vic)[0][:name]
75
+
76
+ assert_equal 'Royal Hobart Regatta', Date.civil(2012, 2, 13).holidays(:au_tas_south)[0][:name]
77
+ assert_equal 'Royal Hobart Regatta', Date.civil(2014, 2, 10).holidays(:au_tas_south)[0][:name]
78
+ assert_equal 'Royal Hobart Regatta', Date.civil(2015, 2, 9).holidays(:au_tas_south)[0][:name]
79
+ assert_equal 'Royal Hobart Regatta', Date.civil(2016, 2, 8).holidays(:au_tas_south)[0][:name]
48
80
  end
49
81
  end
@@ -26,12 +26,37 @@ end
26
26
  assert_equal 'BC Family Day', Holidays.on(date, :ca_bc)[0][:name]
27
27
  end
28
28
 
29
+ # Nova Scotia Heritage Day
30
+ [ Date.civil(2015,2,16), Date.civil(2016,2,15) ].each do |date|
31
+ assert_equal 'Nova Scotia Heritage Day', Holidays.on(date, :ca_ns)[0][:name]
32
+ end
33
+
34
+ # Islander Day in PE
35
+ [ Date.civil(2013,2,18), Date.civil(2014,2,17) ].each do |date|
36
+ assert_equal 'Islander Day', Holidays.on(date, :ca_pe)[0][:name]
37
+ end
38
+
29
39
  # Victoria Day
30
40
  [Date.civil(2004,5,24), Date.civil(2005,5,23), Date.civil(2006,5,22),
31
41
  Date.civil(2007,5,21), Date.civil(2008,5,19)].each do |date|
32
42
  assert_equal 'Victoria Day', Holidays.on(date, :ca)[0][:name]
33
43
  end
34
44
 
45
+ # First Monday in August
46
+ [Date.civil(2013,8,5), Date.civil(2014,8,4), Date.civil(2015,8,3)].each do |date|
47
+ { :ca_bc => 'BC Day',
48
+ :ca_sk => 'Saskatchewan Day',
49
+ :ca_ab => 'Heritage Day',
50
+ :ca_ns => 'Natal Day',
51
+ :ca_on => 'Civic Holiday',
52
+ :ca_nt => 'Civic Holiday',
53
+ :ca_nu => 'Civic Holiday',
54
+ :ca_pe => 'Civic Holiday',
55
+ :ca_nb => 'New Brunswick Day' }.each do |region, name|
56
+ assert_equal name, Holidays.on(date, region)[0][:name]
57
+ end
58
+ end
59
+
35
60
 
36
61
  {Date.civil(2013,2,2) => 'Groundhog Day',
37
62
  Date.civil(2013,2,14) => 'Valentine\'s Day',
@@ -0,0 +1,22 @@
1
+ # encoding: utf-8
2
+ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
3
+
4
+ # This file is generated by the Ruby Holiday gem.
5
+ #
6
+ # Definitions loaded: data/cr.yaml
7
+ class CrDefinitionTests < Test::Unit::TestCase # :nodoc:
8
+
9
+ def test_cr
10
+ {Date.civil(2015,1,1) => 'Año Nuevo',
11
+ Date.civil(2015,4,11) => 'Día de Juan Santamaría',
12
+ Date.civil(2015,5,1) => 'Día del Trabajador',
13
+ Date.civil(2015,7,25) => 'Día de la Anexión de Guanacaste',
14
+ Date.civil(2015,8,2) => 'Día de la Virgen de los Angeles',
15
+ Date.civil(2015,8,15) => 'Día de la Madre',
16
+ Date.civil(2015,9,15) => 'Día de la Independencia',
17
+ Date.civil(2015,10,12) => 'Día de las Culturas',
18
+ Date.civil(2016,12,25) => 'Navidad'}.each do |date, name|
19
+ assert_equal name, (Holidays.on(date, :cr)[0] || {})[:name]
20
+ end
21
+ end
22
+ end
@@ -39,27 +39,27 @@ end
39
39
  assert_equal 'Allerheiligen', Date.civil(2009,11,1).holidays(r)[0][:name]
40
40
  end
41
41
 
42
- [:de_be, :de_bb, :de_hb, :de_hh, :de_ni, :de_sh].each do |r|
42
+ [:de_be, :de_hb, :de_hh, :de_ni, :de_sh].each do |r|
43
43
  assert_equal 'Tag der Deutschen Einheit', Date.civil(2009,10,3).holidays(r)[0][:name]
44
44
  end
45
45
 
46
- [:de_be, :de_hb, :de_hh, :de_ni, :de_sh].each do |r|
46
+ [:de_be, :de_hb, :de_hh, :de_ni, :de_sh].each do |r|
47
47
  assert !Date.civil(2009,1,6).holiday?(r), "Heilige Drei Könige is not a holiday in #{r}"
48
48
  end
49
49
 
50
- [:de_be, :de_hb, :de_hh, :de_ni, :de_sh].each do |r|
50
+ [:de_be, :de_hb, :de_hh, :de_ni, :de_sh].each do |r|
51
51
  assert !Date.civil(2009,6,11).holiday?(r), "Fronleichnam is not a holiday in #{r}"
52
52
  end
53
53
 
54
- [:de_be, :de_hb, :de_hh, :de_ni, :de_sh].each do |r|
54
+ [:de_be, :de_hb, :de_hh, :de_ni, :de_sh].each do |r|
55
55
  assert !Date.civil(2009,8,15).holiday?(r), "Mariä Himmelfahrt is not a holiday in #{r}"
56
56
  end
57
57
 
58
- [:de_be, :de_hb, :de_hh, :de_ni, :de_sh].each do |r|
58
+ [:de_be, :de_hb, :de_hh, :de_ni, :de_sh].each do |r|
59
59
  assert !Date.civil(2009,10,31).holiday?(r), 'Reformationstag is not a holiday in #{r}'
60
60
  end
61
61
 
62
- [:de_be, :de_bb, :de_hb, :de_hh, :de_ni, :de_sh].each do |r|
62
+ [:de_be, :de_hb, :de_hh, :de_ni, :de_sh].each do |r|
63
63
  assert !Date.civil(2009,11,1).holiday?(r), "Allerheiligen is not a holiday in #{r}"
64
64
  end
65
65
 
@@ -134,6 +134,30 @@ end
134
134
  assert_equal 'Allerheiligen', Date.civil(2009,11,1).holidays(r)[0][:name]
135
135
  end
136
136
 
137
+ [:de_be, :de_hb, :de_hh, :de_ni, :de_sh].each do |r|
138
+ assert_equal 'Tag der Deutschen Einheit', Date.civil(2009,10,3).holidays(r)[0][:name]
139
+ end
140
+
141
+ [:de_be, :de_hb, :de_hh, :de_ni, :de_sh].each do |r|
142
+ assert !Date.civil(2009,1,6).holiday?(r), "Heilige Drei Könige is not a holiday in #{r}"
143
+ end
144
+
145
+ [:de_be, :de_hb, :de_hh, :de_ni, :de_sh].each do |r|
146
+ assert !Date.civil(2009,6,11).holiday?(r), "Fronleichnam is not a holiday in #{r}"
147
+ end
148
+
149
+ [:de_be, :de_hb, :de_hh, :de_ni, :de_sh].each do |r|
150
+ assert !Date.civil(2009,8,15).holiday?(r), "Mariä Himmelfahrt is not a holiday in #{r}"
151
+ end
152
+
153
+ [:de_be, :de_hb, :de_hh, :de_ni, :de_sh].each do |r|
154
+ assert !Date.civil(2009,10,31).holiday?(r), 'Reformationstag is not a holiday in #{r}'
155
+ end
156
+
157
+ [:de_be, :de_hb, :de_hh, :de_ni, :de_sh].each do |r|
158
+ assert !Date.civil(2009,11,1).holiday?(r), "Allerheiligen is not a holiday in #{r}"
159
+ end
160
+
137
161
  assert !Date.civil(2010,5,8).holiday?(:de), '2010-05-08 is not a holiday in Germany'
138
162
 
139
163
  # Repentance Day
@@ -0,0 +1,21 @@
1
+ # encoding: utf-8
2
+ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
3
+
4
+ # This file is generated by the Ruby Holiday gem.
5
+ #
6
+ # Definitions loaded: data/fedex.yaml
7
+ class Fed_exDefinitionTests < Test::Unit::TestCase # :nodoc:
8
+
9
+ def test_fed_ex
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(2015,12,25) => 'Christmas Day',
17
+ Date.civil(2015,12,31) => 'New Year\'s Eve',}.each do |date, name|
18
+ assert_equal name, (Holidays.on(date, :ups)[0] || {})[:name]
19
+ end
20
+ end
21
+ end
@@ -10,72 +10,59 @@ class Federal_reserveDefinitionTests < Test::Unit::TestCase # :nodoc:
10
10
  {Date.civil(2012,1,2) => "New Year's Day",
11
11
  Date.civil(2012,1,16) => "Birthday of Martin Luther King, Jr",
12
12
  Date.civil(2012,2,20) => "Washington's Birthday",
13
- Date.civil(2012,4,6) => "Good Friday",
14
13
  Date.civil(2012,5,28) => "Memorial Day",
15
14
  Date.civil(2012,7,4) => "Independence Day",
16
15
  Date.civil(2012,9,3) => "Labor Day",
17
16
  Date.civil(2012,10,8) => "Columbus Day",
18
17
  Date.civil(2012,11,12) => "Veterans Day",
19
18
  Date.civil(2012,11,22) => "Thanksgiving Day",
20
- Date.civil(2012,12,24) => "Christmas Eve",
21
19
  Date.civil(2012,12,25) => "Christmas Day",
22
- Date.civil(2012,12,31) => "New Year's Eve",
23
20
 
24
21
  Date.civil(2013,1,1) => "New Year's Day",
25
22
  Date.civil(2013,1,21) => "Birthday of Martin Luther King, Jr",
26
23
  Date.civil(2013,2,18) => "Washington's Birthday",
27
- Date.civil(2013,3,29) => "Good Friday",
28
24
  Date.civil(2013,5,27) => "Memorial Day",
29
25
  Date.civil(2013,7,4) => "Independence Day",
30
26
  Date.civil(2013,9,2) => "Labor Day",
31
27
  Date.civil(2013,10,14) => "Columbus Day",
32
28
  Date.civil(2013,11,11) => "Veterans Day",
33
29
  Date.civil(2013,11,28) => "Thanksgiving Day",
34
- Date.civil(2013,12,24) => "Christmas Eve",
35
30
  Date.civil(2013,12,25) => "Christmas Day",
36
- Date.civil(2013,12,31) => "New Year's Eve",
37
31
 
38
32
  Date.civil(2014,1,1) => "New Year's Day",
39
33
  Date.civil(2014,1,20) => "Birthday of Martin Luther King, Jr",
40
34
  Date.civil(2014,2,17) => "Washington's Birthday",
41
- Date.civil(2014,4,18) => "Good Friday",
42
35
  Date.civil(2014,5,26) => "Memorial Day",
43
36
  Date.civil(2014,7,4) => "Independence Day",
44
37
  Date.civil(2014,9,1) => "Labor Day",
45
38
  Date.civil(2014,10,13) => "Columbus Day",
46
39
  Date.civil(2014,11,11) => "Veterans Day",
47
40
  Date.civil(2014,11,27) => "Thanksgiving Day",
48
- Date.civil(2014,12,24) => "Christmas Eve",
49
41
  Date.civil(2014,12,25) => "Christmas Day",
50
- Date.civil(2014,12,31) => "New Year's Eve",
51
42
 
52
43
  Date.civil(2015,1,1) => "New Year's Day",
53
44
  Date.civil(2015,1,19) => "Birthday of Martin Luther King, Jr",
54
45
  Date.civil(2015,2,16) => "Washington's Birthday",
55
- Date.civil(2015,4,3) => "Good Friday",
56
46
  Date.civil(2015,5,25) => "Memorial Day",
57
47
  Date.civil(2015,7,4) => "Independence Day",
58
48
  Date.civil(2015,9,7) => "Labor Day",
59
49
  Date.civil(2015,10,12) => "Columbus Day",
60
50
  Date.civil(2015,11,11) => "Veterans Day",
61
51
  Date.civil(2015,11,26) => "Thanksgiving Day",
62
- Date.civil(2015,12,24) => "Christmas Eve",
63
52
  Date.civil(2015,12,25) => "Christmas Day",
64
- Date.civil(2015,12,31) => "New Year's Eve",
65
53
 
66
54
  Date.civil(2016,1,1) => "New Year's Day",
67
55
  Date.civil(2016,1,18) => "Birthday of Martin Luther King, Jr",
68
56
  Date.civil(2016,2,15) => "Washington's Birthday",
69
- Date.civil(2016,3,25) => "Good Friday",
70
57
  Date.civil(2016,5,30) => "Memorial Day",
71
58
  Date.civil(2016,7,4) => "Independence Day",
72
59
  Date.civil(2016,9,5) => "Labor Day",
73
60
  Date.civil(2016,10,10) => "Columbus Day",
74
61
  Date.civil(2016,11,11) => "Veterans Day",
75
62
  Date.civil(2016,11,24) => "Thanksgiving Day",
76
- Date.civil(2016,12,24) => "Christmas Eve",
77
63
  Date.civil(2016,12,26) => "Christmas Day",
78
- Date.civil(2016,12,31) => "New Year's Eve",
64
+
65
+ Date.civil(2017,1, 20) => "Inauguration Day",
79
66
  }.each do |date, name|
80
67
  assert_equal name, (Holidays.on(date, :federal_reserve, :observed)[0] || {})[:name]
81
68
  end
@@ -21,6 +21,7 @@ class JpDefinitionTests < Test::Unit::TestCase # :nodoc:
21
21
  Date.civil(2008,12,23) => '天皇誕生日',
22
22
  Date.civil(2010,3,22) => '振替休日',
23
23
  Date.civil(2008,11,24) => '振替休日',
24
+ Date.civil(2012,1,2) => '振替休日',
24
25
  }.each do |date, name|
25
26
  assert_equal name, (Holidays.on(date, :jp, :informal)[0] || {})[:name]
26
27
  end
@@ -26,12 +26,37 @@ end
26
26
  assert_equal 'BC Family Day', Holidays.on(date, :ca_bc)[0][:name]
27
27
  end
28
28
 
29
+ # Nova Scotia Heritage Day
30
+ [ Date.civil(2015,2,16), Date.civil(2016,2,15) ].each do |date|
31
+ assert_equal 'Nova Scotia Heritage Day', Holidays.on(date, :ca_ns)[0][:name]
32
+ end
33
+
34
+ # Islander Day in PE
35
+ [ Date.civil(2013,2,18), Date.civil(2014,2,17) ].each do |date|
36
+ assert_equal 'Islander Day', Holidays.on(date, :ca_pe)[0][:name]
37
+ end
38
+
29
39
  # Victoria Day
30
40
  [Date.civil(2004,5,24), Date.civil(2005,5,23), Date.civil(2006,5,22),
31
41
  Date.civil(2007,5,21), Date.civil(2008,5,19)].each do |date|
32
42
  assert_equal 'Victoria Day', Holidays.on(date, :ca)[0][:name]
33
43
  end
34
44
 
45
+ # First Monday in August
46
+ [Date.civil(2013,8,5), Date.civil(2014,8,4), Date.civil(2015,8,3)].each do |date|
47
+ { :ca_bc => 'BC Day',
48
+ :ca_sk => 'Saskatchewan Day',
49
+ :ca_ab => 'Heritage Day',
50
+ :ca_ns => 'Natal Day',
51
+ :ca_on => 'Civic Holiday',
52
+ :ca_nt => 'Civic Holiday',
53
+ :ca_nu => 'Civic Holiday',
54
+ :ca_pe => 'Civic Holiday',
55
+ :ca_nb => 'New Brunswick Day' }.each do |region, name|
56
+ assert_equal name, Holidays.on(date, region)[0][:name]
57
+ end
58
+ end
59
+
35
60
 
36
61
  {Date.civil(2007,1,1) => 'Año nuevo',
37
62
  Date.civil(2007,2,5) => 'Día de la Constitución',
@@ -0,0 +1,12 @@
1
+ # encoding: utf-8
2
+ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
3
+
4
+ # This file is generated by the Ruby Holiday gem.
5
+ #
6
+ # Definitions loaded: data/united_nations.yaml
7
+ class United_nationsDefinitionTests < Test::Unit::TestCase # :nodoc:
8
+
9
+ def test_united_nations
10
+
11
+ end
12
+ end
@@ -0,0 +1,35 @@
1
+ require File.expand_path(File.dirname(__FILE__)) + '/test_helper'
2
+
3
+ class CustomHolidaysTest < Test::Unit::TestCase
4
+
5
+ def test_custom_region_present_after_single_file_parsing
6
+ assert_raises Holidays::UnknownRegionError do
7
+ Holidays.on(Date.civil(2013,6,20), :custom_single_file)
8
+ end
9
+
10
+ Holidays.load_custom('test/data/test_single_custom_holiday_defs.yaml')
11
+
12
+ assert_not_equal [], Holidays.on(Date.civil(2013,6,20), :custom_single_file)
13
+ end
14
+
15
+ def test_custom_holidays_present_after_multiple_file_parsing
16
+ assert_raises Holidays::UnknownRegionError do
17
+ Holidays.on(Date.civil(2013, 10,5), :custom_multiple_files)
18
+ end
19
+
20
+ assert_raises Holidays::UnknownRegionError do
21
+ Holidays.on(Date.civil(2013,3,1), :custom_multiple_files)
22
+ end
23
+
24
+ assert_raises Holidays::UnknownRegionError do
25
+ Holidays.on(Date.civil(2013,3,1), :custom_multiple_files_govt)
26
+ end
27
+
28
+ Holidays.load_custom('test/data/test_multiple_custom_holiday_defs.yaml', 'test/data/test_custom_govt_holiday_defs.yaml')
29
+
30
+ assert_not_equal [], Holidays.on(Date.civil(2013,10,5), :custom_multiple_files)
31
+ assert_not_equal [], Holidays.on(Date.civil(2013,3,1), :custom_multiple_files)
32
+ assert_not_equal [], Holidays.on(Date.civil(2013,3,1), :custom_multiple_files_govt)
33
+ end
34
+
35
+ end