holidays 5.7.0 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitmodules +1 -1
- data/CHANGELOG.md +11 -0
- data/lib/generated_definitions/north_america.rb +1 -1
- data/lib/generated_definitions/tr.rb +1 -0
- data/lib/generated_definitions/us.rb +1 -1
- data/lib/holidays/definition/context/generator.rb +5 -36
- data/lib/holidays/definition/decorator/test.rb +37 -0
- data/lib/holidays/definition/entity/test.rb +11 -0
- data/lib/holidays/definition/generator/test.rb +51 -0
- data/lib/holidays/definition/parser/test.rb +86 -0
- data/lib/holidays/definition/validator/test.rb +71 -0
- data/lib/holidays/errors.rb +3 -0
- data/lib/holidays/factory/definition.rb +24 -0
- data/lib/holidays/version.rb +1 -1
- data/test/coverage_report.rb +1 -0
- data/test/data/test_custom_year_range_holiday_defs.yaml +7 -0
- data/test/data/test_multiple_custom_holiday_defs.yaml +7 -4
- data/test/data/test_single_custom_holiday_defs.yaml +7 -4
- data/test/data/test_single_custom_holiday_with_custom_procs.yaml +11 -7
- data/test/defs/test_defs_ar.rb +33 -19
- data/test/defs/test_defs_at.rb +14 -11
- data/test/defs/test_defs_au.rb +172 -141
- data/test/defs/test_defs_be_fr.rb +23 -14
- data/test/defs/test_defs_be_nl.rb +23 -14
- data/test/defs/test_defs_bg.rb +29 -17
- data/test/defs/test_defs_br.rb +33 -19
- data/test/defs/test_defs_ca.rb +175 -176
- data/test/defs/test_defs_ch.rb +29 -23
- data/test/defs/test_defs_cl.rb +49 -27
- data/test/defs/test_defs_cr.rb +17 -11
- data/test/defs/test_defs_cz.rb +25 -15
- data/test/defs/test_defs_de.rb +52 -61
- data/test/defs/test_defs_dk.rb +31 -19
- data/test/defs/test_defs_ecb_target.rb +14 -10
- data/test/defs/test_defs_ee.rb +28 -20
- data/test/defs/test_defs_el.rb +29 -17
- data/test/defs/test_defs_es.rb +114 -52
- data/test/defs/test_defs_europe.rb +1154 -715
- data/test/defs/test_defs_federal_reserve.rb +99 -57
- data/test/defs/test_defs_fedex.rb +19 -12
- data/test/defs/test_defs_fi.rb +47 -27
- data/test/defs/test_defs_fr.rb +29 -24
- data/test/defs/test_defs_gb.rb +90 -51
- data/test/defs/test_defs_ge.rb +40 -28
- data/test/defs/test_defs_hk.rb +47 -26
- data/test/defs/test_defs_hr.rb +32 -18
- data/test/defs/test_defs_hu.rb +26 -16
- data/test/defs/test_defs_ie.rb +41 -25
- data/test/defs/test_defs_is.rb +39 -22
- data/test/defs/test_defs_it.rb +23 -14
- data/test/defs/test_defs_jp.rb +112 -59
- data/test/defs/test_defs_kr.rb +25 -17
- data/test/defs/test_defs_li.rb +20 -20
- data/test/defs/test_defs_lt.rb +51 -30
- data/test/defs/test_defs_lu.rb +17 -12
- data/test/defs/test_defs_ma.rb +17 -11
- data/test/defs/test_defs_mt_en.rb +28 -19
- data/test/defs/test_defs_mt_mt.rb +28 -19
- data/test/defs/test_defs_mx.rb +33 -22
- data/test/defs/test_defs_my.rb +11 -8
- data/test/defs/test_defs_nerc.rb +17 -11
- data/test/defs/test_defs_nl.rb +21 -13
- data/test/defs/test_defs_no.rb +31 -18
- data/test/defs/test_defs_north_america.rb +507 -393
- data/test/defs/test_defs_nyse.rb +26 -15
- data/test/defs/test_defs_nz.rb +47 -28
- data/test/defs/test_defs_pe.rb +35 -20
- data/test/defs/test_defs_ph.rb +17 -11
- data/test/defs/test_defs_pl.rb +200 -119
- data/test/defs/test_defs_pt.rb +33 -24
- data/test/defs/test_defs_ro.rb +39 -24
- data/test/defs/test_defs_rs_cyrl.rb +33 -26
- data/test/defs/test_defs_rs_la.rb +33 -26
- data/test/defs/test_defs_ru.rb +22 -16
- data/test/defs/test_defs_scandinavia.rb +193 -116
- data/test/defs/test_defs_se.rb +47 -28
- data/test/defs/test_defs_sg.rb +13 -9
- data/test/defs/test_defs_si.rb +93 -24
- data/test/defs/test_defs_sk.rb +29 -17
- data/test/defs/test_defs_tn.rb +15 -10
- data/test/defs/test_defs_tr.rb +39 -30
- data/test/defs/test_defs_united_nations.rb +0 -1
- data/test/defs/test_defs_ups.rb +19 -12
- data/test/defs/test_defs_us.rb +333 -217
- data/test/defs/test_defs_ve.rb +23 -16
- data/test/defs/test_defs_vi.rb +10 -8
- data/test/defs/test_defs_za.rb +23 -14
- data/test/holidays/definition/context/test_generator.rb +40 -13
- data/test/holidays/definition/decorator/test_test.rb +123 -0
- data/test/holidays/definition/generator/test_test.rb +113 -0
- data/test/holidays/definition/parser/test_test.rb +142 -0
- data/test/holidays/definition/validator/test_region.rb +5 -0
- data/test/holidays/definition/validator/test_test.rb +60 -0
- metadata +15 -8
- data/test/holidays/factory/test_date_calculator.rb +0 -32
- data/test/holidays/factory/test_definition.rb +0 -62
- data/test/holidays/factory/test_finder.rb +0 -25
@@ -7,20 +7,29 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
|
7
7
|
class Be_frDefinitionTests < Test::Unit::TestCase # :nodoc:
|
8
8
|
|
9
9
|
def test_be_fr
|
10
|
-
|
11
|
-
|
12
|
-
Date.civil(2007,4,
|
13
|
-
|
14
|
-
Date.civil(2007,
|
15
|
-
|
16
|
-
Date.civil(2007,5,
|
17
|
-
|
18
|
-
Date.civil(2007,
|
19
|
-
|
20
|
-
Date.civil(2007,
|
21
|
-
|
22
|
-
|
23
|
-
|
10
|
+
assert_equal "Jour de l'an", (Holidays.on(Date.civil(2007, 1, 1), [:be_fr], [:informal])[0] || {})[:name]
|
11
|
+
|
12
|
+
assert_equal "Pâques", (Holidays.on(Date.civil(2007, 4, 8), [:be_fr], [:informal])[0] || {})[:name]
|
13
|
+
|
14
|
+
assert_equal "Lundi de Pâques", (Holidays.on(Date.civil(2007, 4, 9), [:be_fr], [:informal])[0] || {})[:name]
|
15
|
+
|
16
|
+
assert_equal "Fête du travail", (Holidays.on(Date.civil(2007, 5, 1), [:be_fr], [:informal])[0] || {})[:name]
|
17
|
+
|
18
|
+
assert_equal "Ascension", (Holidays.on(Date.civil(2007, 5, 17), [:be_fr], [:informal])[0] || {})[:name]
|
19
|
+
|
20
|
+
assert_equal "Pentecôte", (Holidays.on(Date.civil(2007, 5, 27), [:be_fr], [:informal])[0] || {})[:name]
|
21
|
+
|
22
|
+
assert_equal "Lundi de Pentecôte", (Holidays.on(Date.civil(2007, 5, 28), [:be_fr], [:informal])[0] || {})[:name]
|
23
|
+
|
24
|
+
assert_equal "Fête nationale", (Holidays.on(Date.civil(2007, 7, 21), [:be_fr], [:informal])[0] || {})[:name]
|
25
|
+
|
26
|
+
assert_equal "Assomption", (Holidays.on(Date.civil(2007, 8, 15), [:be_fr], [:informal])[0] || {})[:name]
|
27
|
+
|
28
|
+
assert_equal "Toussaint", (Holidays.on(Date.civil(2007, 11, 1), [:be_fr], [:informal])[0] || {})[:name]
|
29
|
+
|
30
|
+
assert_equal "Armistice 1918", (Holidays.on(Date.civil(2007, 11, 11), [:be_fr], [:informal])[0] || {})[:name]
|
31
|
+
|
32
|
+
assert_equal "Noël", (Holidays.on(Date.civil(2007, 12, 25), [:be_fr], [:informal])[0] || {})[:name]
|
24
33
|
|
25
34
|
end
|
26
35
|
end
|
@@ -7,20 +7,29 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
|
7
7
|
class Be_nlDefinitionTests < Test::Unit::TestCase # :nodoc:
|
8
8
|
|
9
9
|
def test_be_nl
|
10
|
-
|
11
|
-
|
12
|
-
Date.civil(2007,4,
|
13
|
-
|
14
|
-
Date.civil(2007,
|
15
|
-
|
16
|
-
Date.civil(2007,5,
|
17
|
-
|
18
|
-
Date.civil(2007,
|
19
|
-
|
20
|
-
Date.civil(2007,
|
21
|
-
|
22
|
-
|
23
|
-
|
10
|
+
assert_equal "Nieuwjaar", (Holidays.on(Date.civil(2007, 1, 1), [:be_nl], [:informal])[0] || {})[:name]
|
11
|
+
|
12
|
+
assert_equal "Pasen", (Holidays.on(Date.civil(2007, 4, 8), [:be_nl], [:informal])[0] || {})[:name]
|
13
|
+
|
14
|
+
assert_equal "Paasmaandag", (Holidays.on(Date.civil(2007, 4, 9), [:be_nl], [:informal])[0] || {})[:name]
|
15
|
+
|
16
|
+
assert_equal "Feest van de Arbeid", (Holidays.on(Date.civil(2007, 5, 1), [:be_nl], [:informal])[0] || {})[:name]
|
17
|
+
|
18
|
+
assert_equal "O.H. Hemelvaart", (Holidays.on(Date.civil(2007, 5, 17), [:be_nl], [:informal])[0] || {})[:name]
|
19
|
+
|
20
|
+
assert_equal "Pinksteren", (Holidays.on(Date.civil(2007, 5, 27), [:be_nl], [:informal])[0] || {})[:name]
|
21
|
+
|
22
|
+
assert_equal "Pinkstermaandag", (Holidays.on(Date.civil(2007, 5, 28), [:be_nl], [:informal])[0] || {})[:name]
|
23
|
+
|
24
|
+
assert_equal "Nationale Feestdag", (Holidays.on(Date.civil(2007, 7, 21), [:be_nl], [:informal])[0] || {})[:name]
|
25
|
+
|
26
|
+
assert_equal "O.L.V. Hemelvaart", (Holidays.on(Date.civil(2007, 8, 15), [:be_nl], [:informal])[0] || {})[:name]
|
27
|
+
|
28
|
+
assert_equal "Allerheiligen", (Holidays.on(Date.civil(2007, 11, 1), [:be_nl], [:informal])[0] || {})[:name]
|
29
|
+
|
30
|
+
assert_equal "Wapenstilstand 1918", (Holidays.on(Date.civil(2007, 11, 11), [:be_nl], [:informal])[0] || {})[:name]
|
31
|
+
|
32
|
+
assert_equal "Kerstmis", (Holidays.on(Date.civil(2007, 12, 25), [:be_nl], [:informal])[0] || {})[:name]
|
24
33
|
|
25
34
|
end
|
26
35
|
end
|
data/test/defs/test_defs_bg.rb
CHANGED
@@ -7,23 +7,35 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
|
7
7
|
class BgDefinitionTests < Test::Unit::TestCase # :nodoc:
|
8
8
|
|
9
9
|
def test_bg
|
10
|
-
|
11
|
-
|
12
|
-
Date.civil(2015,3,
|
13
|
-
|
14
|
-
Date.civil(2015,3,
|
15
|
-
|
16
|
-
Date.civil(2015,
|
17
|
-
|
18
|
-
Date.civil(2015,
|
19
|
-
|
20
|
-
Date.civil(2015,
|
21
|
-
|
22
|
-
Date.civil(2015,
|
23
|
-
|
24
|
-
Date.civil(2015,
|
25
|
-
|
26
|
-
|
10
|
+
assert_equal "New Year's Day", (Holidays.on(Date.civil(2015, 1, 1), [:bg_en])[0] || {})[:name]
|
11
|
+
|
12
|
+
assert_equal "Liberation Day", (Holidays.on(Date.civil(2015, 3, 3), [:bg_en])[0] || {})[:name]
|
13
|
+
|
14
|
+
assert_equal "Good Friday", (Holidays.on(Date.civil(2015, 3, 28), [:bg_en])[0] || {})[:name]
|
15
|
+
|
16
|
+
assert_equal "Holy Saturday", (Holidays.on(Date.civil(2015, 3, 29), [:bg_en])[0] || {})[:name]
|
17
|
+
|
18
|
+
assert_equal "Easter Sunday", (Holidays.on(Date.civil(2015, 3, 30), [:bg_en])[0] || {})[:name]
|
19
|
+
|
20
|
+
assert_equal "Easter Monday", (Holidays.on(Date.civil(2015, 3, 31), [:bg_en])[0] || {})[:name]
|
21
|
+
|
22
|
+
assert_equal "Labour Day", (Holidays.on(Date.civil(2015, 5, 1), [:bg_en])[0] || {})[:name]
|
23
|
+
|
24
|
+
assert_equal "St. George's Day", (Holidays.on(Date.civil(2015, 5, 6), [:bg_en])[0] || {})[:name]
|
25
|
+
|
26
|
+
assert_equal "Slavic Literacy Day", (Holidays.on(Date.civil(2015, 5, 24), [:bg_en])[0] || {})[:name]
|
27
|
+
|
28
|
+
assert_equal "Unification Day", (Holidays.on(Date.civil(2015, 9, 6), [:bg_en])[0] || {})[:name]
|
29
|
+
|
30
|
+
assert_equal "The Independence Day", (Holidays.on(Date.civil(2015, 9, 22), [:bg_en])[0] || {})[:name]
|
31
|
+
|
32
|
+
assert_equal "Revival Leader's Day", (Holidays.on(Date.civil(2015, 11, 1), [:bg_en])[0] || {})[:name]
|
33
|
+
|
34
|
+
assert_equal "Christmas Eve", (Holidays.on(Date.civil(2015, 12, 24), [:bg_en])[0] || {})[:name]
|
35
|
+
|
36
|
+
assert_equal "Christmas", (Holidays.on(Date.civil(2015, 12, 25), [:bg_en])[0] || {})[:name]
|
37
|
+
|
38
|
+
assert_equal "Christmas", (Holidays.on(Date.civil(2015, 12, 26), [:bg_en])[0] || {})[:name]
|
27
39
|
|
28
40
|
end
|
29
41
|
end
|
data/test/defs/test_defs_br.rb
CHANGED
@@ -7,25 +7,39 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
|
7
7
|
class BrDefinitionTests < Test::Unit::TestCase # :nodoc:
|
8
8
|
|
9
9
|
def test_br
|
10
|
-
|
11
|
-
|
12
|
-
Date.civil(
|
13
|
-
|
14
|
-
Date.civil(
|
15
|
-
|
16
|
-
Date.civil(
|
17
|
-
|
18
|
-
Date.civil(2008,5,
|
19
|
-
|
20
|
-
Date.civil(
|
21
|
-
|
22
|
-
Date.civil(2008,
|
23
|
-
|
24
|
-
Date.civil(2008,
|
25
|
-
|
26
|
-
Date.civil(2008,
|
27
|
-
|
28
|
-
|
10
|
+
assert_equal "Dia da Confraternização Universal", (Holidays.on(Date.civil(2008, 1, 1), [:br], [:informal])[0] || {})[:name]
|
11
|
+
|
12
|
+
assert_equal "Carnaval", (Holidays.on(Date.civil(2005, 2, 8), [:br], [:informal])[0] || {})[:name]
|
13
|
+
|
14
|
+
assert_equal "Carnaval", (Holidays.on(Date.civil(2006, 2, 28), [:br], [:informal])[0] || {})[:name]
|
15
|
+
|
16
|
+
assert_equal "Carnaval", (Holidays.on(Date.civil(2007, 2, 20), [:br], [:informal])[0] || {})[:name]
|
17
|
+
|
18
|
+
assert_equal "Carnaval", (Holidays.on(Date.civil(2008, 2, 5), [:br], [:informal])[0] || {})[:name]
|
19
|
+
|
20
|
+
assert_equal "Sexta-feira Santa", (Holidays.on(Date.civil(2008, 3, 21), [:br], [:informal])[0] || {})[:name]
|
21
|
+
|
22
|
+
assert_equal "Páscoa", (Holidays.on(Date.civil(2008, 3, 23), [:br], [:informal])[0] || {})[:name]
|
23
|
+
|
24
|
+
assert_equal "Dia de Tiradentes", (Holidays.on(Date.civil(2008, 4, 21), [:br], [:informal])[0] || {})[:name]
|
25
|
+
|
26
|
+
assert_equal "Dia do Trabalho", (Holidays.on(Date.civil(2008, 5, 1), [:br], [:informal])[0] || {})[:name]
|
27
|
+
|
28
|
+
assert_equal "Corpus Christi", (Holidays.on(Date.civil(2005, 5, 26), [:br], [:informal])[0] || {})[:name]
|
29
|
+
|
30
|
+
assert_equal "Corpus Christi", (Holidays.on(Date.civil(2007, 6, 7), [:br], [:informal])[0] || {})[:name]
|
31
|
+
|
32
|
+
assert_equal "Corpus Christi", (Holidays.on(Date.civil(2008, 5, 22), [:br], [:informal])[0] || {})[:name]
|
33
|
+
|
34
|
+
assert_equal "Proclamação da Independência", (Holidays.on(Date.civil(2008, 9, 7), [:br], [:informal])[0] || {})[:name]
|
35
|
+
|
36
|
+
assert_equal "Dia de Nossa Senhora Aparecida", (Holidays.on(Date.civil(2008, 10, 12), [:br], [:informal])[0] || {})[:name]
|
37
|
+
|
38
|
+
assert_equal "Dia de Finados", (Holidays.on(Date.civil(2008, 11, 2), [:br], [:informal])[0] || {})[:name]
|
39
|
+
|
40
|
+
assert_equal "Proclamação da República", (Holidays.on(Date.civil(2008, 11, 15), [:br], [:informal])[0] || {})[:name]
|
41
|
+
|
42
|
+
assert_equal "Natal", (Holidays.on(Date.civil(2008, 12, 25), [:br], [:informal])[0] || {})[:name]
|
29
43
|
|
30
44
|
end
|
31
45
|
end
|
data/test/defs/test_defs_ca.rb
CHANGED
@@ -7,205 +7,204 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
|
7
7
|
class CaDefinitionTests < Test::Unit::TestCase # :nodoc:
|
8
8
|
|
9
9
|
def test_ca
|
10
|
-
|
11
|
-
Date.civil(2008,3,21) => 'Good Friday',
|
12
|
-
Date.civil(2013,3,31) => 'Easter Sunday',
|
13
|
-
Date.civil(2008,3,24) => 'Easter Monday',
|
14
|
-
Date.civil(2008,7,1) => 'Canada Day',
|
15
|
-
Date.civil(2008,9,1) => 'Labour Day',
|
16
|
-
Date.civil(2008,12,25) => 'Christmas Day'}.each do |date, name|
|
17
|
-
assert_equal name, (Holidays.on(date, :ca, :informal)[0] || {})[:name]
|
18
|
-
end
|
10
|
+
assert_equal "New Year's Day", (Holidays.on(Date.civil(2008, 1, 1), [:ca], [:informal])[0] || {})[:name]
|
19
11
|
|
20
|
-
|
21
|
-
[
|
22
|
-
Date.civil(1990,2,19),
|
23
|
-
Date.civil(2013,2,18),
|
24
|
-
Date.civil(2014,2,17),
|
25
|
-
Date.civil(2044,2,15),
|
26
|
-
].each do |date|
|
27
|
-
assert_equal 'Family Day', Holidays.on(date, :ca_ab)[0][:name]
|
28
|
-
end
|
12
|
+
assert_equal "Good Friday", (Holidays.on(Date.civil(2008, 3, 21), [:ca], [:informal])[0] || {})[:name]
|
29
13
|
|
30
|
-
|
31
|
-
[
|
32
|
-
Date.civil(1970,2,16),
|
33
|
-
Date.civil(1988,2,15),
|
34
|
-
Date.civil(1989,2,20),
|
35
|
-
].each do |date|
|
36
|
-
assert_equal [], Holidays.on(date, :ca_ab)
|
37
|
-
end
|
14
|
+
assert_equal "Easter Sunday", (Holidays.on(Date.civil(2013, 3, 31), [:ca], [:informal])[0] || {})[:name]
|
38
15
|
|
39
|
-
|
40
|
-
[
|
41
|
-
Date.civil(2007,2,19),
|
42
|
-
Date.civil(2013,2,18),
|
43
|
-
Date.civil(2014,2,17),
|
44
|
-
Date.civil(2044,2,15),
|
45
|
-
].each do |date|
|
46
|
-
assert_equal 'Family Day', Holidays.on(date, :ca_sk)[0][:name]
|
47
|
-
end
|
16
|
+
assert_equal "Easter Monday", (Holidays.on(Date.civil(2008, 3, 24), [:ca], [:informal])[0] || {})[:name]
|
48
17
|
|
49
|
-
|
50
|
-
[
|
51
|
-
Date.civil(1970,2,16),
|
52
|
-
Date.civil(1988,2,15),
|
53
|
-
Date.civil(1989,2,20),
|
54
|
-
Date.civil(2006,2,20),
|
55
|
-
].each do |date|
|
56
|
-
assert_equal [], Holidays.on(date, :ca_sk)
|
57
|
-
end
|
18
|
+
assert_equal "Canada Day", (Holidays.on(Date.civil(2008, 7, 1), [:ca], [:informal])[0] || {})[:name]
|
58
19
|
|
59
|
-
|
60
|
-
[
|
61
|
-
Date.civil(2008,2,18),
|
62
|
-
Date.civil(2013,2,18),
|
63
|
-
Date.civil(2014,2,17),
|
64
|
-
Date.civil(2044,2,15),
|
65
|
-
].each do |date|
|
66
|
-
assert_equal 'Family Day', Holidays.on(date, :ca_on)[0][:name]
|
67
|
-
end
|
20
|
+
assert_equal "Labour Day", (Holidays.on(Date.civil(2008, 9, 1), [:ca], [:informal])[0] || {})[:name]
|
68
21
|
|
69
|
-
|
70
|
-
[
|
71
|
-
Date.civil(1970,2,16),
|
72
|
-
Date.civil(1988,2,15),
|
73
|
-
Date.civil(1989,2,20),
|
74
|
-
Date.civil(2006,2,20),
|
75
|
-
Date.civil(2007,2,19),
|
76
|
-
].each do |date|
|
77
|
-
assert_equal [], Holidays.on(date, :ca_on)
|
78
|
-
end
|
22
|
+
assert_equal "Christmas Day", (Holidays.on(Date.civil(2008, 12, 25), [:ca], [:informal])[0] || {})[:name]
|
79
23
|
|
80
|
-
|
81
|
-
[
|
82
|
-
Date.civil(2013,2,11),
|
83
|
-
Date.civil(2014,2,10),
|
84
|
-
Date.civil(2044,2,8),
|
85
|
-
].each do |date|
|
86
|
-
assert_equal 'Family Day', Holidays.on(date, :ca_bc)[0][:name]
|
87
|
-
end
|
24
|
+
assert_equal "Family Day", (Holidays.on(Date.civil(1990, 2, 19), [:ca_ab])[0] || {})[:name]
|
88
25
|
|
89
|
-
|
90
|
-
[
|
91
|
-
Date.civil(2000,2,14),
|
92
|
-
Date.civil(2011,2,14),
|
93
|
-
Date.civil(2012,2,13),
|
94
|
-
].each do |date|
|
95
|
-
assert_equal [], Holidays.on(date, :ca_bc)
|
96
|
-
end
|
26
|
+
assert_equal "Family Day", (Holidays.on(Date.civil(2013, 2, 18), [:ca_ab])[0] || {})[:name]
|
97
27
|
|
98
|
-
|
99
|
-
[
|
100
|
-
Date.civil(2015,2,16),
|
101
|
-
Date.civil(2016,2,15),
|
102
|
-
Date.civil(2017,2,20),
|
103
|
-
Date.civil(2044,2,15),
|
104
|
-
].each do |date|
|
105
|
-
assert_equal 'Nova Scotia Heritage Day', Holidays.on(date, :ca_ns)[0][:name]
|
106
|
-
end
|
28
|
+
assert_equal "Family Day", (Holidays.on(Date.civil(2014, 2, 17), [:ca_ab])[0] || {})[:name]
|
107
29
|
|
108
|
-
|
109
|
-
[
|
110
|
-
Date.civil(2000,2,21),
|
111
|
-
Date.civil(2012,2,20),
|
112
|
-
Date.civil(2013,2,18),
|
113
|
-
Date.civil(2014,2,17),
|
114
|
-
].each do |date|
|
115
|
-
assert_equal [], Holidays.on(date, :ca_ns)
|
116
|
-
end
|
30
|
+
assert_equal "Family Day", (Holidays.on(Date.civil(2044, 2, 15), [:ca_ab])[0] || {})[:name]
|
117
31
|
|
118
|
-
|
119
|
-
[ Date.civil(2013,2,18), Date.civil(2014,2,17) ].each do |date|
|
120
|
-
assert_equal 'Islander Day', Holidays.on(date, :ca_pe)[0][:name]
|
121
|
-
end
|
32
|
+
assert_nil (Holidays.on(Date.civil(1970, 2, 16), [:ca_ab])[0] || {})[:name]
|
122
33
|
|
34
|
+
assert_nil (Holidays.on(Date.civil(1988, 2, 15), [:ca_ab])[0] || {})[:name]
|
123
35
|
|
124
|
-
|
125
|
-
[:ca_ab, :ca_bc, :ca_mb, :ca_nt, :ca_nu, :ca_on, :ca_sk, :ca_yt].each do |r|
|
126
|
-
[
|
127
|
-
Date.civil(2004,5,24), Date.civil(2005,5,23), Date.civil(2006,5,22),
|
128
|
-
Date.civil(2007,5,21), Date.civil(2008,5,19)
|
129
|
-
].each do |date|
|
130
|
-
assert_equal 'Victoria Day', Holidays.on(date, r)[0][:name]
|
131
|
-
end
|
132
|
-
end
|
36
|
+
assert_nil (Holidays.on(Date.civil(1989, 2, 20), [:ca_ab])[0] || {})[:name]
|
133
37
|
|
134
|
-
|
135
|
-
[Date.civil(2013,8,5), Date.civil(2014,8,4), Date.civil(2015,8,3)].each do |date|
|
136
|
-
{ :ca_bc => 'B.C. Day',
|
137
|
-
:ca_sk => 'Saskatchewan Day',
|
138
|
-
:ca_ab => 'Heritage Day',
|
139
|
-
:ca_ns => 'Natal Day',
|
140
|
-
:ca_nt => 'Civic Holiday',
|
141
|
-
:ca_nu => 'Civic Holiday',
|
142
|
-
:ca_pe => 'Civic Holiday',
|
143
|
-
:ca_nb => 'New Brunswick Day'
|
144
|
-
}.each do |region, name|
|
145
|
-
assert_equal name, Holidays.on(date, region)[0][:name]
|
146
|
-
end
|
147
|
-
end
|
38
|
+
assert_equal "Family Day", (Holidays.on(Date.civil(2007, 2, 19), [:ca_sk])[0] || {})[:name]
|
148
39
|
|
149
|
-
|
150
|
-
[Date.civil(2013,8,5), Date.civil(2014,8,4), Date.civil(2015,8,3)].each do |date|
|
151
|
-
assert_equal 'Civic Holiday', Holidays.on(date, :ca_on, :informal)[0][:name]
|
152
|
-
end
|
40
|
+
assert_equal "Family Day", (Holidays.on(Date.civil(2013, 2, 18), [:ca_sk])[0] || {})[:name]
|
153
41
|
|
154
|
-
|
155
|
-
# except (Nova Scotia, Manitoba, Ontario, and Quebec)
|
156
|
-
[
|
157
|
-
:ca_ab,
|
158
|
-
:ca_sk,
|
159
|
-
:ca_bc,
|
160
|
-
:ca_pe,
|
161
|
-
:ca_nl,
|
162
|
-
:ca_nt,
|
163
|
-
:ca_nu,
|
164
|
-
:ca_nb,
|
165
|
-
:ca_yt
|
166
|
-
].each do |province|
|
167
|
-
# Remembrance Day observed
|
168
|
-
[Date.civil(2010, 11, 11), Date.civil(2012, 11, 12), Date.civil(2017, 11, 13)].each do |date|
|
169
|
-
assert_equal 'Remembrance Day', Holidays.on(date, province, :observed)[0][:name]
|
170
|
-
end
|
42
|
+
assert_equal "Family Day", (Holidays.on(Date.civil(2014, 2, 17), [:ca_sk])[0] || {})[:name]
|
171
43
|
|
172
|
-
|
173
|
-
assert_equal "Remembrance Day", Holidays.on(Date.civil(2016,11,11), province)[0][:name]
|
174
|
-
end
|
44
|
+
assert_equal "Family Day", (Holidays.on(Date.civil(2044, 2, 15), [:ca_sk])[0] || {})[:name]
|
175
45
|
|
176
|
-
|
177
|
-
[Date.civil(2011, 1, 3), Date.civil(2012, 1, 2), Date.civil(2016, 1, 1)].each do |date|
|
178
|
-
assert_equal 'New Year\'s Day', Holidays.on(date, :ca, :observed)[0][:name]
|
179
|
-
end
|
46
|
+
assert_nil (Holidays.on(Date.civil(1970, 2, 16), [:ca_sk])[0] || {})[:name]
|
180
47
|
|
181
|
-
|
182
|
-
[Date.civil(2011, 7, 1), Date.civil(2012, 7, 2), Date.civil(2017, 7, 3)].each do |date|
|
183
|
-
assert_equal 'Canada Day', Holidays.on(date, :ca, :observed)[0][:name]
|
184
|
-
end
|
48
|
+
assert_nil (Holidays.on(Date.civil(1988, 2, 15), [:ca_sk])[0] || {})[:name]
|
185
49
|
|
186
|
-
|
187
|
-
[Date.civil(2010, 12, 27), Date.civil(2012, 12, 25), Date.civil(2016, 12, 26)].each do |date|
|
188
|
-
assert_equal 'Christmas Day', Holidays.on(date, :ca, :observed)[0][:name]
|
189
|
-
end
|
50
|
+
assert_nil (Holidays.on(Date.civil(1989, 2, 20), [:ca_sk])[0] || {})[:name]
|
190
51
|
|
191
|
-
|
192
|
-
[Date.civil(2010, 12, 28), Date.civil(2012, 12, 26), Date.civil(2016, 12, 27),
|
193
|
-
Date.civil(2015, 12, 28)].each do |date|
|
194
|
-
assert_equal 'Boxing Day', Holidays.on(date, :ca_on, :observed)[0][:name]
|
195
|
-
end
|
52
|
+
assert_nil (Holidays.on(Date.civil(2006, 2, 20), [:ca_sk])[0] || {})[:name]
|
196
53
|
|
54
|
+
assert_equal "Family Day", (Holidays.on(Date.civil(2008, 2, 18), [:ca_on])[0] || {})[:name]
|
197
55
|
|
198
|
-
|
199
|
-
|
200
|
-
Date.civil(
|
201
|
-
|
202
|
-
Date.civil(
|
203
|
-
|
204
|
-
Date.civil(
|
205
|
-
|
206
|
-
Date.civil(
|
207
|
-
|
208
|
-
|
56
|
+
assert_equal "Family Day", (Holidays.on(Date.civil(2013, 2, 18), [:ca_on])[0] || {})[:name]
|
57
|
+
|
58
|
+
assert_equal "Family Day", (Holidays.on(Date.civil(2014, 2, 17), [:ca_on])[0] || {})[:name]
|
59
|
+
|
60
|
+
assert_equal "Family Day", (Holidays.on(Date.civil(2044, 2, 15), [:ca_on])[0] || {})[:name]
|
61
|
+
|
62
|
+
assert_nil (Holidays.on(Date.civil(1970, 2, 16), [:ca_on])[0] || {})[:name]
|
63
|
+
|
64
|
+
assert_nil (Holidays.on(Date.civil(1988, 2, 15), [:ca_on])[0] || {})[:name]
|
65
|
+
|
66
|
+
assert_nil (Holidays.on(Date.civil(1989, 2, 20), [:ca_on])[0] || {})[:name]
|
67
|
+
|
68
|
+
assert_nil (Holidays.on(Date.civil(2006, 2, 20), [:ca_on])[0] || {})[:name]
|
69
|
+
|
70
|
+
assert_nil (Holidays.on(Date.civil(2007, 2, 19), [:ca_on])[0] || {})[:name]
|
71
|
+
|
72
|
+
assert_equal "Family Day", (Holidays.on(Date.civil(2013, 2, 11), [:ca_bc])[0] || {})[:name]
|
73
|
+
|
74
|
+
assert_equal "Family Day", (Holidays.on(Date.civil(2014, 2, 10), [:ca_bc])[0] || {})[:name]
|
75
|
+
|
76
|
+
assert_equal "Family Day", (Holidays.on(Date.civil(2044, 2, 8), [:ca_bc])[0] || {})[:name]
|
77
|
+
|
78
|
+
assert_nil (Holidays.on(Date.civil(2000, 2, 14), [:ca_bc])[0] || {})[:name]
|
79
|
+
|
80
|
+
assert_nil (Holidays.on(Date.civil(2011, 2, 14), [:ca_bc])[0] || {})[:name]
|
81
|
+
|
82
|
+
assert_nil (Holidays.on(Date.civil(2012, 2, 13), [:ca_bc])[0] || {})[:name]
|
83
|
+
|
84
|
+
assert_equal "Nova Scotia Heritage Day", (Holidays.on(Date.civil(2015, 2, 16), [:ca_ns])[0] || {})[:name]
|
85
|
+
|
86
|
+
assert_equal "Nova Scotia Heritage Day", (Holidays.on(Date.civil(2016, 2, 15), [:ca_ns])[0] || {})[:name]
|
87
|
+
|
88
|
+
assert_equal "Nova Scotia Heritage Day", (Holidays.on(Date.civil(2017, 2, 20), [:ca_ns])[0] || {})[:name]
|
89
|
+
|
90
|
+
assert_equal "Nova Scotia Heritage Day", (Holidays.on(Date.civil(2044, 2, 15), [:ca_ns])[0] || {})[:name]
|
91
|
+
|
92
|
+
assert_nil (Holidays.on(Date.civil(2000, 2, 21), [:ca_ns])[0] || {})[:name]
|
93
|
+
|
94
|
+
assert_nil (Holidays.on(Date.civil(2012, 2, 20), [:ca_ns])[0] || {})[:name]
|
95
|
+
|
96
|
+
assert_nil (Holidays.on(Date.civil(2013, 2, 18), [:ca_ns])[0] || {})[:name]
|
97
|
+
|
98
|
+
assert_nil (Holidays.on(Date.civil(2014, 2, 17), [:ca_ns])[0] || {})[:name]
|
99
|
+
|
100
|
+
assert_equal "Islander Day", (Holidays.on(Date.civil(2013, 2, 18), [:ca_pe])[0] || {})[:name]
|
101
|
+
|
102
|
+
assert_equal "Islander Day", (Holidays.on(Date.civil(2014, 2, 17), [:ca_pe])[0] || {})[:name]
|
103
|
+
|
104
|
+
assert_equal "Victoria Day", (Holidays.on(Date.civil(2004, 5, 24), [:ca_ab, :ca_bc, :ca_mb, :ca_nt, :ca_nu, :ca_on, :ca_sk, :ca_yt])[0] || {})[:name]
|
105
|
+
assert_equal "Victoria Day", (Holidays.on(Date.civil(2005, 5, 23), [:ca_ab, :ca_bc, :ca_mb, :ca_nt, :ca_nu, :ca_on, :ca_sk, :ca_yt])[0] || {})[:name]
|
106
|
+
assert_equal "Victoria Day", (Holidays.on(Date.civil(2006, 5, 22), [:ca_ab, :ca_bc, :ca_mb, :ca_nt, :ca_nu, :ca_on, :ca_sk, :ca_yt])[0] || {})[:name]
|
107
|
+
assert_equal "Victoria Day", (Holidays.on(Date.civil(2007, 5, 21), [:ca_ab, :ca_bc, :ca_mb, :ca_nt, :ca_nu, :ca_on, :ca_sk, :ca_yt])[0] || {})[:name]
|
108
|
+
assert_equal "Victoria Day", (Holidays.on(Date.civil(2008, 5, 19), [:ca_ab, :ca_bc, :ca_mb, :ca_nt, :ca_nu, :ca_on, :ca_sk, :ca_yt])[0] || {})[:name]
|
109
|
+
|
110
|
+
assert_equal "B.C. Day", (Holidays.on(Date.civil(2013, 8, 5), [:ca_bc])[0] || {})[:name]
|
111
|
+
|
112
|
+
assert_equal "Saskatchewan Day", (Holidays.on(Date.civil(2013, 8, 5), [:ca_sk])[0] || {})[:name]
|
113
|
+
|
114
|
+
assert_equal "Heritage Day", (Holidays.on(Date.civil(2013, 8, 5), [:ca_ab])[0] || {})[:name]
|
115
|
+
|
116
|
+
assert_equal "Natal Day", (Holidays.on(Date.civil(2013, 8, 5), [:ca_ns])[0] || {})[:name]
|
117
|
+
|
118
|
+
assert_equal "Civic Holiday", (Holidays.on(Date.civil(2013, 8, 5), [:ca_on], [:informal])[0] || {})[:name]
|
119
|
+
assert_equal "Civic Holiday", (Holidays.on(Date.civil(2014, 8, 4), [:ca_on], [:informal])[0] || {})[:name]
|
120
|
+
assert_equal "Civic Holiday", (Holidays.on(Date.civil(2015, 8, 3), [:ca_on], [:informal])[0] || {})[:name]
|
121
|
+
|
122
|
+
assert_equal "Civic Holiday", (Holidays.on(Date.civil(2013, 8, 5), [:ca_nt])[0] || {})[:name]
|
123
|
+
|
124
|
+
assert_equal "Civic Holiday", (Holidays.on(Date.civil(2013, 8, 5), [:ca_nu])[0] || {})[:name]
|
125
|
+
|
126
|
+
assert_equal "Civic Holiday", (Holidays.on(Date.civil(2013, 8, 5), [:ca_pe])[0] || {})[:name]
|
127
|
+
|
128
|
+
assert_equal "New Brunswick Day", (Holidays.on(Date.civil(2013, 8, 5), [:ca_nb])[0] || {})[:name]
|
129
|
+
|
130
|
+
assert_equal "B.C. Day", (Holidays.on(Date.civil(2014, 8, 4), [:ca_bc])[0] || {})[:name]
|
131
|
+
|
132
|
+
assert_equal "Saskatchewan Day", (Holidays.on(Date.civil(2014, 8, 4), [:ca_sk])[0] || {})[:name]
|
133
|
+
|
134
|
+
assert_equal "Heritage Day", (Holidays.on(Date.civil(2014, 8, 4), [:ca_ab])[0] || {})[:name]
|
135
|
+
|
136
|
+
assert_equal "Natal Day", (Holidays.on(Date.civil(2014, 8, 4), [:ca_ns])[0] || {})[:name]
|
137
|
+
|
138
|
+
assert_equal "Civic Holiday", (Holidays.on(Date.civil(2014, 8, 4), [:ca_nt])[0] || {})[:name]
|
139
|
+
|
140
|
+
assert_equal "Civic Holiday", (Holidays.on(Date.civil(2014, 8, 4), [:ca_nu])[0] || {})[:name]
|
141
|
+
|
142
|
+
assert_equal "Civic Holiday", (Holidays.on(Date.civil(2014, 8, 4), [:ca_pe])[0] || {})[:name]
|
143
|
+
|
144
|
+
assert_equal "New Brunswick Day", (Holidays.on(Date.civil(2014, 8, 4), [:ca_nb])[0] || {})[:name]
|
145
|
+
|
146
|
+
assert_equal "B.C. Day", (Holidays.on(Date.civil(2015, 8, 3), [:ca_bc])[0] || {})[:name]
|
147
|
+
|
148
|
+
assert_equal "Saskatchewan Day", (Holidays.on(Date.civil(2015, 8, 3), [:ca_sk])[0] || {})[:name]
|
149
|
+
|
150
|
+
assert_equal "Heritage Day", (Holidays.on(Date.civil(2015, 8, 3), [:ca_ab])[0] || {})[:name]
|
151
|
+
|
152
|
+
assert_equal "Natal Day", (Holidays.on(Date.civil(2015, 8, 3), [:ca_ns])[0] || {})[:name]
|
153
|
+
|
154
|
+
assert_equal "Civic Holiday", (Holidays.on(Date.civil(2015, 8, 3), [:ca_nt])[0] || {})[:name]
|
155
|
+
|
156
|
+
assert_equal "Civic Holiday", (Holidays.on(Date.civil(2015, 8, 3), [:ca_nu])[0] || {})[:name]
|
157
|
+
|
158
|
+
assert_equal "Civic Holiday", (Holidays.on(Date.civil(2015, 8, 3), [:ca_pe])[0] || {})[:name]
|
159
|
+
|
160
|
+
assert_equal "New Brunswick Day", (Holidays.on(Date.civil(2015, 8, 3), [:ca_nb])[0] || {})[:name]
|
161
|
+
|
162
|
+
assert_equal "Remembrance Day", (Holidays.on(Date.civil(2010, 11, 11), [:ca_ab, :ca_sk, :ca_bc, :ca_pe, :ca_nl, :ca_nt, :ca_nu, :ca_nb, :ca_yt], [:observed])[0] || {})[:name]
|
163
|
+
assert_equal "Remembrance Day", (Holidays.on(Date.civil(2012, 11, 12), [:ca_ab, :ca_sk, :ca_bc, :ca_pe, :ca_nl, :ca_nt, :ca_nu, :ca_nb, :ca_yt], [:observed])[0] || {})[:name]
|
164
|
+
assert_equal "Remembrance Day", (Holidays.on(Date.civil(2017, 11, 13), [:ca_ab, :ca_sk, :ca_bc, :ca_pe, :ca_nl, :ca_nt, :ca_nu, :ca_nb, :ca_yt], [:observed])[0] || {})[:name]
|
165
|
+
|
166
|
+
assert_equal "Remembrance Day", (Holidays.on(Date.civil(2016, 11, 11), [:ca_ab, :ca_sk, :ca_bc, :ca_pe, :ca_nl, :ca_nt, :ca_nu, :ca_nb, :ca_yt])[0] || {})[:name]
|
167
|
+
|
168
|
+
assert_equal "New Year's Day", (Holidays.on(Date.civil(2011, 1, 3), [:ca], [:observed])[0] || {})[:name]
|
169
|
+
|
170
|
+
assert_equal "New Year's Day", (Holidays.on(Date.civil(2012, 1, 2), [:ca], [:observed])[0] || {})[:name]
|
171
|
+
|
172
|
+
assert_equal "New Year's Day", (Holidays.on(Date.civil(2016, 1, 1), [:ca], [:observed])[0] || {})[:name]
|
173
|
+
|
174
|
+
assert_equal "Canada Day", (Holidays.on(Date.civil(2011, 7, 1), [:ca], [:observed])[0] || {})[:name]
|
175
|
+
|
176
|
+
assert_equal "Canada Day", (Holidays.on(Date.civil(2012, 7, 2), [:ca], [:observed])[0] || {})[:name]
|
177
|
+
|
178
|
+
assert_equal "Canada Day", (Holidays.on(Date.civil(2017, 7, 3), [:ca], [:observed])[0] || {})[:name]
|
179
|
+
|
180
|
+
assert_equal "Christmas Day", (Holidays.on(Date.civil(2010, 12, 27), [:ca], [:observed])[0] || {})[:name]
|
181
|
+
|
182
|
+
assert_equal "Christmas Day", (Holidays.on(Date.civil(2012, 12, 25), [:ca], [:observed])[0] || {})[:name]
|
183
|
+
|
184
|
+
assert_equal "Christmas Day", (Holidays.on(Date.civil(2016, 12, 26), [:ca], [:observed])[0] || {})[:name]
|
185
|
+
|
186
|
+
assert_equal "Boxing Day", (Holidays.on(Date.civil(2010, 12, 28), [:ca_on], [:observed])[0] || {})[:name]
|
187
|
+
assert_equal "Boxing Day", (Holidays.on(Date.civil(2012, 12, 26), [:ca_on], [:observed])[0] || {})[:name]
|
188
|
+
assert_equal "Boxing Day", (Holidays.on(Date.civil(2015, 12, 28), [:ca_on], [:observed])[0] || {})[:name]
|
189
|
+
assert_equal "Boxing Day", (Holidays.on(Date.civil(2016, 12, 27), [:ca_on], [:observed])[0] || {})[:name]
|
190
|
+
|
191
|
+
assert_equal "Groundhog Day", (Holidays.on(Date.civil(2013, 2, 2), [:us], [:informal])[0] || {})[:name]
|
192
|
+
|
193
|
+
assert_equal "Valentine's Day", (Holidays.on(Date.civil(2013, 2, 14), [:us], [:informal])[0] || {})[:name]
|
194
|
+
|
195
|
+
assert_equal "St. Patrick's Day", (Holidays.on(Date.civil(2013, 3, 17), [:us], [:informal])[0] || {})[:name]
|
196
|
+
|
197
|
+
assert_equal "April Fool's Day", (Holidays.on(Date.civil(2013, 4, 1), [:us], [:informal])[0] || {})[:name]
|
198
|
+
|
199
|
+
assert_equal "Earth Day", (Holidays.on(Date.civil(2013, 4, 22), [:us], [:informal])[0] || {})[:name]
|
200
|
+
|
201
|
+
assert_equal "Mother's Day", (Holidays.on(Date.civil(2013, 5, 12), [:us], [:informal])[0] || {})[:name]
|
202
|
+
|
203
|
+
assert_equal "Armed Forces Day", (Holidays.on(Date.civil(2013, 5, 18), [:us], [:informal])[0] || {})[:name]
|
204
|
+
|
205
|
+
assert_equal "Father's Day", (Holidays.on(Date.civil(2013, 6, 16), [:us], [:informal])[0] || {})[:name]
|
206
|
+
|
207
|
+
assert_equal "Halloween", (Holidays.on(Date.civil(2013, 10, 31), [:us], [:informal])[0] || {})[:name]
|
209
208
|
|
210
209
|
end
|
211
210
|
end
|