holidays 5.7.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Heh at this file name
|
|
2
|
+
require File.expand_path(File.dirname(__FILE__)) + '/../../../test_helper'
|
|
3
|
+
|
|
4
|
+
require 'holidays/definition/parser/test'
|
|
5
|
+
require 'holidays/definition/entity/test'
|
|
6
|
+
|
|
7
|
+
class ParserTestTests < Test::Unit::TestCase
|
|
8
|
+
def setup
|
|
9
|
+
@validator = mock()
|
|
10
|
+
|
|
11
|
+
@parser = Holidays::Definition::Parser::Test.new(@validator)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def test_parse_no_tests
|
|
15
|
+
input = nil
|
|
16
|
+
result = @parser.call(input)
|
|
17
|
+
|
|
18
|
+
assert_equal(0, result.size)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_parse_single_test_happy
|
|
22
|
+
input = [ { "given" => { "date" => "2016-01-01", "regions" => ['us'] }, "expect" => { "name" => "Test Holiday" } } ]
|
|
23
|
+
@validator.expects(:valid?).with({:dates => ["2016-01-01"], :regions=> ['us'], :options => nil, :name => "Test Holiday", :holiday => nil}).returns(true)
|
|
24
|
+
|
|
25
|
+
result = @parser.call(input)
|
|
26
|
+
|
|
27
|
+
assert_equal(1, result.size)
|
|
28
|
+
|
|
29
|
+
test = result.first
|
|
30
|
+
assert(test)
|
|
31
|
+
|
|
32
|
+
assert(test.is_a?(Holidays::Definition::Entity::Test))
|
|
33
|
+
assert_equal([DateTime.parse('2016-01-01')], test.dates)
|
|
34
|
+
assert_equal([:us], test.regions)
|
|
35
|
+
assert_equal("Test Holiday", test.name)
|
|
36
|
+
assert(test.holiday?)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def test_parse_single_test_with_options
|
|
40
|
+
input = [ { "given" => { "date" => "2016-01-01", "regions" => ['us'], "options" => ['option1']}, "expect" => { "name" => "Test Holiday" } } ]
|
|
41
|
+
@validator.expects(:valid?).with({:dates => ["2016-01-01"], :regions=> ['us'], :name => "Test Holiday", :options => ['option1'], :holiday => nil}).returns(true)
|
|
42
|
+
|
|
43
|
+
result = @parser.call(input)
|
|
44
|
+
|
|
45
|
+
assert_equal(1, result.size)
|
|
46
|
+
|
|
47
|
+
test = result.first
|
|
48
|
+
assert(test)
|
|
49
|
+
|
|
50
|
+
assert(test.is_a?(Holidays::Definition::Entity::Test))
|
|
51
|
+
assert_equal([DateTime.parse('2016-01-01')], test.dates)
|
|
52
|
+
assert_equal([:us], test.regions)
|
|
53
|
+
assert_equal([:option1], test.options)
|
|
54
|
+
assert_equal("Test Holiday", test.name)
|
|
55
|
+
assert(test.holiday?)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def test_parse_single_test_with_single_option_as_string
|
|
59
|
+
input = [ { "given" => { "date" => "2016-01-01", "regions" => ['us'], "options" => 'option1'}, "expect" => { "name" => "Test Holiday" } } ]
|
|
60
|
+
@validator.expects(:valid?).with({:dates => ["2016-01-01"], :regions=> ['us'], :name => "Test Holiday", :options => 'option1', :holiday => nil}).returns(true)
|
|
61
|
+
|
|
62
|
+
result = @parser.call(input)
|
|
63
|
+
|
|
64
|
+
assert_equal(1, result.size)
|
|
65
|
+
|
|
66
|
+
test = result.first
|
|
67
|
+
assert(test)
|
|
68
|
+
|
|
69
|
+
assert(test.is_a?(Holidays::Definition::Entity::Test))
|
|
70
|
+
assert_equal([DateTime.parse('2016-01-01')], test.dates)
|
|
71
|
+
assert_equal([:us], test.regions)
|
|
72
|
+
assert_equal([:option1], test.options)
|
|
73
|
+
assert_equal("Test Holiday", test.name)
|
|
74
|
+
assert(test.holiday?)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def test_parse_single_test_no_name_no_holiday
|
|
78
|
+
input = [ { "given" => { "date" => "2016-01-01", "regions" => ['us']}, "expect" => { "holiday" => false } } ]
|
|
79
|
+
@validator.expects(:valid?).with({:dates => ["2016-01-01"], :regions=> ['us'], :name => nil, :options => nil, :holiday => false}).returns(true)
|
|
80
|
+
|
|
81
|
+
result = @parser.call(input)
|
|
82
|
+
|
|
83
|
+
assert_equal(1, result.size)
|
|
84
|
+
|
|
85
|
+
test = result.first
|
|
86
|
+
assert(test)
|
|
87
|
+
|
|
88
|
+
assert(test.is_a?(Holidays::Definition::Entity::Test))
|
|
89
|
+
assert_equal([DateTime.parse('2016-01-01')], test.dates)
|
|
90
|
+
assert_equal([:us], test.regions)
|
|
91
|
+
assert_nil(test.options)
|
|
92
|
+
assert_nil(test.name)
|
|
93
|
+
assert_equal(false, test.holiday?)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def test_parse_single_test_with_options_no_name_no_holiday
|
|
97
|
+
input = [ { "given" => { "date" => "2016-01-01", "regions" => ['us'], "options" => ['option1']}, "expect" => { "holiday" => false } } ]
|
|
98
|
+
@validator.expects(:valid?).with({:dates => ["2016-01-01"], :regions=> ['us'], :name => nil, :options => ['option1'], :holiday => false}).returns(true)
|
|
99
|
+
|
|
100
|
+
result = @parser.call(input)
|
|
101
|
+
|
|
102
|
+
assert_equal(1, result.size)
|
|
103
|
+
|
|
104
|
+
test = result.first
|
|
105
|
+
assert(test)
|
|
106
|
+
|
|
107
|
+
assert(test.is_a?(Holidays::Definition::Entity::Test))
|
|
108
|
+
assert_equal([DateTime.parse('2016-01-01')], test.dates)
|
|
109
|
+
assert_equal([:us], test.regions)
|
|
110
|
+
assert_equal([:option1], test.options)
|
|
111
|
+
assert_nil(test.name)
|
|
112
|
+
assert_equal(false, test.holiday?)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def test_parse_single_test_multiple_dates
|
|
116
|
+
input = [ { "given" => { "date" => ["2016-01-01", "2017-01-01"], "regions" => ['us']}, "expect" => { "name" => "Test Holiday"} } ]
|
|
117
|
+
@validator.expects(:valid?).with({:dates => ["2016-01-01", "2017-01-01"], :regions=> ['us'], :name => "Test Holiday", :options => nil, :holiday => nil}).returns(true)
|
|
118
|
+
|
|
119
|
+
result = @parser.call(input)
|
|
120
|
+
|
|
121
|
+
assert_equal(1, result.size)
|
|
122
|
+
|
|
123
|
+
test = result.first
|
|
124
|
+
assert(test)
|
|
125
|
+
|
|
126
|
+
assert(test.is_a?(Holidays::Definition::Entity::Test))
|
|
127
|
+
assert_equal([DateTime.parse('2016-01-01'), DateTime.parse('2017-01-01')], test.dates)
|
|
128
|
+
assert_equal([:us], test.regions)
|
|
129
|
+
assert_nil(test.options)
|
|
130
|
+
assert_equal("Test Holiday", test.name)
|
|
131
|
+
assert(test.holiday?)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def test_parse_single_test_fail_validation
|
|
135
|
+
input = [ { "given" => { "date" => "2016-01-01", "regions" => ['us']}, "expect" => { "name" => "Test Holiday"} } ]
|
|
136
|
+
@validator.expects(:valid?).with({:dates => ["2016-01-01"], :regions=> ['us'], :name => "Test Holiday", :options => nil, :holiday => nil}).returns(false)
|
|
137
|
+
|
|
138
|
+
assert_raises ArgumentError do
|
|
139
|
+
@parser.call(input)
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
|
@@ -46,4 +46,9 @@ class RegionValidatorTests < Test::Unit::TestCase
|
|
|
46
46
|
def test_returns_false_if_malicious_region_is_given
|
|
47
47
|
assert_equal(false, @subject.valid?(:"../../../test"))
|
|
48
48
|
end
|
|
49
|
+
|
|
50
|
+
def test_returns_true_with_multiple_underscores
|
|
51
|
+
@regions_repo.expects(:loaded?).with(:some_test_region).returns(true)
|
|
52
|
+
assert(@subject.valid?(:some_test_region))
|
|
53
|
+
end
|
|
49
54
|
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Heh at this file name
|
|
2
|
+
require File.expand_path(File.dirname(__FILE__)) + '/../../../test_helper'
|
|
3
|
+
|
|
4
|
+
require 'holidays/definition/validator/test'
|
|
5
|
+
|
|
6
|
+
class TestValidatorTests < Test::Unit::TestCase
|
|
7
|
+
def setup
|
|
8
|
+
@subject = Holidays::Definition::Validator::Test.new
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def test_returns_true_if_valid
|
|
12
|
+
t = {:dates => ['2016-01-01'], :regions => ['us'], :name => 'test', holiday: true, :options => ['option1']}
|
|
13
|
+
assert @subject.valid?(t)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def test_returns_false_if_missing_dates
|
|
17
|
+
t = {:regions => ['us'], :name => 'test'}
|
|
18
|
+
assert_equal false, @subject.valid?(t)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_returns_false_if_dates_contains_invalid_value
|
|
22
|
+
t = {:dates => ['2016-01-01', 'invalid-date'], :regions => ['us'], :name => 'test'}
|
|
23
|
+
assert_equal false, @subject.valid?(t)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def test_returns_false_if_missing_regions
|
|
27
|
+
t = {:dates => ['2016-01-01'], :name => 'test'}
|
|
28
|
+
assert_equal false, @subject.valid?(t)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def test_returns_false_if_regions_contains_non_string
|
|
32
|
+
t = {:dates => ['2016-01-01'], :regions => [3], :name => 'test'}
|
|
33
|
+
assert_equal false, @subject.valid?(t)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def test_returns_false_if_name_not_a_string
|
|
37
|
+
t = {:dates => ['2016-01-01'], :regions => ['us'], :name => 3}
|
|
38
|
+
assert_equal false, @subject.valid?(t)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def test_returns_false_if_holiday_not_a_boolean
|
|
42
|
+
t = {:dates => ['2016-01-01'], :regions => ['us'], :name => 'Test', :holiday => 'invalid'}
|
|
43
|
+
assert_equal false, @subject.valid?(t)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def test_returns_true_if_options_not_array_but_is_string
|
|
47
|
+
t = {:dates => ['2016-01-01'], :regions => ['us'], :name => 'test', :options => 'option1'}
|
|
48
|
+
assert @subject.valid?(t)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def test_returns_false_if_options_contains_non_string
|
|
52
|
+
t = {:dates => ['2016-01-01'], :regions => ['us'], :name => 'Test', :options => [3]}
|
|
53
|
+
assert_equal false, @subject.valid?(t)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def test_returns_false_if_both_holiday_and_name_are_missing
|
|
57
|
+
t = {:dates => ['2016-01-01'], :regions => ['us']}
|
|
58
|
+
assert_equal false, @subject.valid?(t)
|
|
59
|
+
end
|
|
60
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: holidays
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 6.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alex Dunae
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2017-
|
|
12
|
+
date: 2017-08-01 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bundler
|
|
@@ -214,9 +214,13 @@ files:
|
|
|
214
214
|
- lib/holidays/definition/context/merger.rb
|
|
215
215
|
- lib/holidays/definition/decorator/custom_method_proc.rb
|
|
216
216
|
- lib/holidays/definition/decorator/custom_method_source.rb
|
|
217
|
+
- lib/holidays/definition/decorator/test.rb
|
|
217
218
|
- lib/holidays/definition/entity/custom_method.rb
|
|
219
|
+
- lib/holidays/definition/entity/test.rb
|
|
218
220
|
- lib/holidays/definition/generator/regions.rb
|
|
221
|
+
- lib/holidays/definition/generator/test.rb
|
|
219
222
|
- lib/holidays/definition/parser/custom_method.rb
|
|
223
|
+
- lib/holidays/definition/parser/test.rb
|
|
220
224
|
- lib/holidays/definition/repository/cache.rb
|
|
221
225
|
- lib/holidays/definition/repository/custom_methods.rb
|
|
222
226
|
- lib/holidays/definition/repository/holidays_by_month.rb
|
|
@@ -224,6 +228,7 @@ files:
|
|
|
224
228
|
- lib/holidays/definition/repository/regions.rb
|
|
225
229
|
- lib/holidays/definition/validator/custom_method.rb
|
|
226
230
|
- lib/holidays/definition/validator/region.rb
|
|
231
|
+
- lib/holidays/definition/validator/test.rb
|
|
227
232
|
- lib/holidays/errors.rb
|
|
228
233
|
- lib/holidays/factory/date_calculator.rb
|
|
229
234
|
- lib/holidays/factory/definition.rb
|
|
@@ -328,8 +333,11 @@ files:
|
|
|
328
333
|
- test/holidays/definition/context/test_merger.rb
|
|
329
334
|
- test/holidays/definition/decorator/test_custom_method_proc.rb
|
|
330
335
|
- test/holidays/definition/decorator/test_custom_method_source.rb
|
|
336
|
+
- test/holidays/definition/decorator/test_test.rb
|
|
331
337
|
- test/holidays/definition/generator/test_regions.rb
|
|
338
|
+
- test/holidays/definition/generator/test_test.rb
|
|
332
339
|
- test/holidays/definition/parser/test_custom_method.rb
|
|
340
|
+
- test/holidays/definition/parser/test_test.rb
|
|
333
341
|
- test/holidays/definition/repository/test_cache.rb
|
|
334
342
|
- test/holidays/definition/repository/test_custom_methods.rb
|
|
335
343
|
- test/holidays/definition/repository/test_holidays_by_month.rb
|
|
@@ -337,9 +345,7 @@ files:
|
|
|
337
345
|
- test/holidays/definition/repository/test_regions.rb
|
|
338
346
|
- test/holidays/definition/validator/test_custom_method.rb
|
|
339
347
|
- test/holidays/definition/validator/test_region.rb
|
|
340
|
-
- test/holidays/
|
|
341
|
-
- test/holidays/factory/test_definition.rb
|
|
342
|
-
- test/holidays/factory/test_finder.rb
|
|
348
|
+
- test/holidays/definition/validator/test_test.rb
|
|
343
349
|
- test/holidays/finder/context/test_between.rb
|
|
344
350
|
- test/holidays/finder/context/test_dates_driver_builder.rb
|
|
345
351
|
- test/holidays/finder/context/test_next_holiday.rb
|
|
@@ -472,8 +478,11 @@ test_files:
|
|
|
472
478
|
- test/holidays/definition/context/test_merger.rb
|
|
473
479
|
- test/holidays/definition/decorator/test_custom_method_proc.rb
|
|
474
480
|
- test/holidays/definition/decorator/test_custom_method_source.rb
|
|
481
|
+
- test/holidays/definition/decorator/test_test.rb
|
|
475
482
|
- test/holidays/definition/generator/test_regions.rb
|
|
483
|
+
- test/holidays/definition/generator/test_test.rb
|
|
476
484
|
- test/holidays/definition/parser/test_custom_method.rb
|
|
485
|
+
- test/holidays/definition/parser/test_test.rb
|
|
477
486
|
- test/holidays/definition/repository/test_cache.rb
|
|
478
487
|
- test/holidays/definition/repository/test_custom_methods.rb
|
|
479
488
|
- test/holidays/definition/repository/test_holidays_by_month.rb
|
|
@@ -481,9 +490,7 @@ test_files:
|
|
|
481
490
|
- test/holidays/definition/repository/test_regions.rb
|
|
482
491
|
- test/holidays/definition/validator/test_custom_method.rb
|
|
483
492
|
- test/holidays/definition/validator/test_region.rb
|
|
484
|
-
- test/holidays/
|
|
485
|
-
- test/holidays/factory/test_definition.rb
|
|
486
|
-
- test/holidays/factory/test_finder.rb
|
|
493
|
+
- test/holidays/definition/validator/test_test.rb
|
|
487
494
|
- test/holidays/finder/context/test_between.rb
|
|
488
495
|
- test/holidays/finder/context/test_dates_driver_builder.rb
|
|
489
496
|
- test/holidays/finder/context/test_next_holiday.rb
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__)) + '/../../test_helper'
|
|
2
|
-
|
|
3
|
-
require 'holidays/factory/date_calculator'
|
|
4
|
-
|
|
5
|
-
class DateCalculatorFactoryTests < Test::Unit::TestCase
|
|
6
|
-
def setup
|
|
7
|
-
@subject = Holidays::Factory::DateCalculator
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def test_day_of_month_calculator
|
|
11
|
-
assert @subject.day_of_month_calculator.is_a?(Holidays::DateCalculator::DayOfMonth)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def test_weekend_modifier
|
|
15
|
-
assert @subject.weekend_modifier.is_a?(Holidays::DateCalculator::WeekendModifier)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def test_easter_calculator_gregorian
|
|
19
|
-
@subject = @subject::Easter::Gregorian
|
|
20
|
-
assert @subject.easter_calculator.is_a?(Holidays::DateCalculator::Easter::Gregorian)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def test_easter_calculator_julian
|
|
24
|
-
@subject = @subject::Easter::Julian
|
|
25
|
-
assert @subject.easter_calculator.is_a?(Holidays::DateCalculator::Easter::Julian)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def test_lunar_date
|
|
29
|
-
assert @subject.lunar_date.is_a?(Holidays::DateCalculator::LunarDate)
|
|
30
|
-
assert @subject.lunar_date.respond_to?('to_solar')
|
|
31
|
-
end
|
|
32
|
-
end
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__)) + '/../../test_helper'
|
|
2
|
-
|
|
3
|
-
require 'holidays/factory/definition'
|
|
4
|
-
|
|
5
|
-
class DefinitionFactoryTests < Test::Unit::TestCase
|
|
6
|
-
def test_definition_file_parser
|
|
7
|
-
assert Holidays::Factory::Definition.file_parser.is_a?(Holidays::Definition::Context::Generator)
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def test_definition_source_generator
|
|
11
|
-
assert Holidays::Factory::Definition.source_generator.is_a?(Holidays::Definition::Context::Generator)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def test_definition_merger
|
|
15
|
-
assert Holidays::Factory::Definition.merger.is_a?(Holidays::Definition::Context::Merger)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def test_holidays_by_month_repository
|
|
19
|
-
assert Holidays::Factory::Definition.holidays_by_month_repository.is_a?(Holidays::Definition::Repository::HolidaysByMonth)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def test_regions_repository
|
|
23
|
-
assert Holidays::Factory::Definition.regions_repository.is_a?(Holidays::Definition::Repository::Regions)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def test_cache_repository
|
|
27
|
-
assert Holidays::Factory::Definition.cache_repository.is_a?(Holidays::Definition::Repository::Cache)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def test_proc_result_cache_repository
|
|
31
|
-
assert Holidays::Factory::Definition.proc_result_cache_repository.is_a?(Holidays::Definition::Repository::ProcResultCache)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def test_custom_method_parser
|
|
35
|
-
assert Holidays::Factory::Definition.custom_method_parser.is_a?(Holidays::Definition::Parser::CustomMethod)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def test_custom_method_source_decorator
|
|
39
|
-
assert Holidays::Factory::Definition.custom_method_source_decorator.is_a?(Holidays::Definition::Decorator::CustomMethodSource)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def test_custom_method_validator
|
|
43
|
-
assert Holidays::Factory::Definition.custom_method_validator.is_a?(Holidays::Definition::Validator::CustomMethod)
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def test_region_validator
|
|
47
|
-
assert Holidays::Factory::Definition.region_validator.is_a?(Holidays::Definition::Validator::Region)
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def test_function_processor
|
|
51
|
-
assert Holidays::Factory::Definition.function_processor.is_a?(Holidays::Definition::Context::FunctionProcessor)
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def test_regions_generator
|
|
55
|
-
assert Holidays::Factory::Definition.regions_generator.is_a?(Holidays::Definition::Generator::Regions)
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def test_definitions_loader
|
|
59
|
-
assert Holidays::Factory::Definition.loader.is_a?(Holidays::Definition::Context::Load)
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
end
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__)) + '/../../test_helper'
|
|
2
|
-
|
|
3
|
-
require 'holidays/factory/finder'
|
|
4
|
-
|
|
5
|
-
class FinderFactoryTests < Test::Unit::TestCase
|
|
6
|
-
def test_search
|
|
7
|
-
assert Holidays::Factory::Finder.search.is_a?(Holidays::Finder::Context::Search)
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def test_between
|
|
11
|
-
assert Holidays::Factory::Finder.between.is_a?(Holidays::Finder::Context::Between)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def test_next_holiday
|
|
15
|
-
assert Holidays::Factory::Finder.next_holiday.is_a?(Holidays::Finder::Context::NextHoliday)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def test_year_holiday
|
|
19
|
-
assert Holidays::Factory::Finder.year_holiday.is_a?(Holidays::Finder::Context::YearHoliday)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def test_parse_options_factory
|
|
23
|
-
assert Holidays::Factory::Finder.parse_options.is_a?(Holidays::Finder::Context::ParseOptions)
|
|
24
|
-
end
|
|
25
|
-
end
|