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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 788dbb02897d92ddba5782a595ff549ae9b90478
|
|
4
|
+
data.tar.gz: a6bf5489300f2232fc4f780e1c7da23b26ba4a5c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e9cfa0dde1527587bf9a6e97f6e9f21c1d630054246153f043ff2f8e1988e4d9c1af5e58356a4500087a7d2701c1e8a7d7b9647e429de8194d964ce8ad79d652
|
|
7
|
+
data.tar.gz: f5a2656bfddff46697837e710284879c778e7d9c37c86759f71aadabcb2999a3f169c676c81779550d435bc49d27f3a6e93a29d1ecb11d16def719ff97035d19
|
data/.gitmodules
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Ruby Holidays Gem CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 6.0.0
|
|
4
|
+
|
|
5
|
+
* Remove support for ruby 2.1.0 since it is [no longer officially supported](https://www.ruby-lang.org/en/news/2017/04/01/support-of-ruby-2-1-has-ended/). This is the cause of the major
|
|
6
|
+
version bump.
|
|
7
|
+
* Update to [v2.0.0 definitions](https://github.com/holidays/definitions/releases/tag/v2.0.0). This changes the format
|
|
8
|
+
of definition tests and requires the other changes.
|
|
9
|
+
* Rewrite test generation logic to consume new YAML format.
|
|
10
|
+
|
|
11
|
+
To be crystal clear: this version should not behave differently in terms of holiday results than v5.7.0 of the gem. Any
|
|
12
|
+
differences are a bug that should be addressed.
|
|
13
|
+
|
|
3
14
|
## 5.7.0
|
|
4
15
|
|
|
5
16
|
* Update to [v1.7.1 definitions](https://github.com/holidays/definitions/releases/tag/v1.7.1). Please see the
|
|
@@ -158,7 +158,7 @@ date
|
|
|
158
158
|
|
|
159
159
|
"christmas_eve_holiday(date)" => Proc.new { |date|
|
|
160
160
|
beginning_of_month = Date.civil(date.year, date.month, 1)
|
|
161
|
-
(date.saturday? || date.sunday?) ? date.downto(beginning_of_month).find {|
|
|
161
|
+
(date.saturday? || date.sunday?) ? date.downto(beginning_of_month).find {|d| d if d.wday == 5} : date
|
|
162
162
|
},
|
|
163
163
|
|
|
164
164
|
"rosh_hashanah(year)" => Proc.new { |year|
|
|
@@ -23,6 +23,7 @@ module Holidays
|
|
|
23
23
|
4 => [{:mday => 23, :name => "Ulusal Egemenlik ve Çocuk Bayramı", :regions => [:tr]}],
|
|
24
24
|
5 => [{:mday => 1, :name => "Emek ve Dayanışma Günü", :regions => [:tr]},
|
|
25
25
|
{:mday => 19, :name => "Atatürk'ü Anma Gençlik ve Spor Bayramı", :regions => [:tr]}],
|
|
26
|
+
7 => [{:mday => 15, :year_ranges => [{:after => 2016}],:name => "Demokrasi ve Milli Birlik Günü", :regions => [:tr]}],
|
|
26
27
|
8 => [{:mday => 30, :name => "Zafer Bayramı", :regions => [:tr]}],
|
|
27
28
|
10 => [{:mday => 29, :name => "Cumhuriyet Bayramı", :regions => [:tr]}]
|
|
28
29
|
}
|
|
@@ -92,7 +92,7 @@ module Holidays
|
|
|
92
92
|
{
|
|
93
93
|
"christmas_eve_holiday(date)" => Proc.new { |date|
|
|
94
94
|
beginning_of_month = Date.civil(date.year, date.month, 1)
|
|
95
|
-
(date.saturday? || date.sunday?) ? date.downto(beginning_of_month).find {|
|
|
95
|
+
(date.saturday? || date.sunday?) ? date.downto(beginning_of_month).find {|d| d if d.wday == 5} : date
|
|
96
96
|
},
|
|
97
97
|
|
|
98
98
|
"rosh_hashanah(year)" => Proc.new { |year|
|
|
@@ -11,10 +11,12 @@ module Holidays
|
|
|
11
11
|
module Definition
|
|
12
12
|
module Context
|
|
13
13
|
class Generator
|
|
14
|
-
def initialize(custom_method_parser, custom_method_source_decorator, custom_methods_repository)
|
|
14
|
+
def initialize(custom_method_parser, custom_method_source_decorator, custom_methods_repository, test_parser, test_source_generator)
|
|
15
15
|
@custom_method_parser = custom_method_parser
|
|
16
16
|
@custom_method_source_decorator = custom_method_source_decorator
|
|
17
17
|
@custom_methods_repository = custom_methods_repository
|
|
18
|
+
@test_parser = test_parser
|
|
19
|
+
@test_source_generator = test_source_generator
|
|
18
20
|
end
|
|
19
21
|
|
|
20
22
|
def parse_definition_files(files)
|
|
@@ -47,7 +49,7 @@ module Holidays
|
|
|
47
49
|
# on each other so we need a solution.
|
|
48
50
|
all_custom_methods.merge!(custom_methods)
|
|
49
51
|
|
|
50
|
-
all_tests
|
|
52
|
+
all_tests += @test_parser.call(definition_file['tests'])
|
|
51
53
|
end
|
|
52
54
|
|
|
53
55
|
all_regions.flatten!.uniq!
|
|
@@ -65,7 +67,7 @@ module Holidays
|
|
|
65
67
|
end
|
|
66
68
|
|
|
67
69
|
module_src = generate_module_src(module_name, files, regions, month_strings, custom_method_string)
|
|
68
|
-
test_src =
|
|
70
|
+
test_src = @test_source_generator.call(module_name, files, tests)
|
|
69
71
|
|
|
70
72
|
return module_src, test_src || ''
|
|
71
73
|
end
|
|
@@ -135,16 +137,6 @@ module Holidays
|
|
|
135
137
|
end
|
|
136
138
|
end
|
|
137
139
|
|
|
138
|
-
def parse_test_definitions(tests)
|
|
139
|
-
test_strings = []
|
|
140
|
-
|
|
141
|
-
if tests
|
|
142
|
-
test_strings << tests
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
test_strings
|
|
146
|
-
end
|
|
147
|
-
|
|
148
140
|
#FIXME This should really be split out and tested with its own unit tests.
|
|
149
141
|
def generate_month_definition_strings(rules_by_month, parsed_custom_methods)
|
|
150
142
|
month_strings = []
|
|
@@ -258,29 +250,6 @@ end
|
|
|
258
250
|
|
|
259
251
|
return module_src
|
|
260
252
|
end
|
|
261
|
-
|
|
262
|
-
def generate_test_src(module_name, files, tests)
|
|
263
|
-
unless tests.empty?
|
|
264
|
-
test_src = ""
|
|
265
|
-
|
|
266
|
-
test_src =<<-EndOfTests
|
|
267
|
-
# encoding: utf-8
|
|
268
|
-
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
|
269
|
-
|
|
270
|
-
# This file is generated by the Ruby Holiday gem.
|
|
271
|
-
#
|
|
272
|
-
# Definitions loaded: #{files.join(', ')}
|
|
273
|
-
class #{module_name.to_s.capitalize}DefinitionTests < Test::Unit::TestCase # :nodoc:
|
|
274
|
-
|
|
275
|
-
def test_#{module_name.to_s.downcase}
|
|
276
|
-
#{tests.join("\n\n")}
|
|
277
|
-
end
|
|
278
|
-
end
|
|
279
|
-
EndOfTests
|
|
280
|
-
end
|
|
281
|
-
|
|
282
|
-
return test_src
|
|
283
|
-
end
|
|
284
253
|
end
|
|
285
254
|
end
|
|
286
255
|
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module Holidays
|
|
2
|
+
module Definition
|
|
3
|
+
module Decorator
|
|
4
|
+
class Test
|
|
5
|
+
def call(t)
|
|
6
|
+
src = ""
|
|
7
|
+
|
|
8
|
+
t.dates.each do |d|
|
|
9
|
+
date = "Date.civil(#{d.year}, #{d.month}, #{d.day})"
|
|
10
|
+
|
|
11
|
+
holiday_call = "Holidays.on(#{date}, #{t.regions}"
|
|
12
|
+
|
|
13
|
+
if t.options
|
|
14
|
+
holiday_call += ", #{decorate_options(t.options)}"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
if t.holiday?
|
|
18
|
+
src += "assert_equal \"#{t.name}\", (#{holiday_call})[0] || {})[:name]\n"
|
|
19
|
+
else
|
|
20
|
+
src += "assert_nil (#{holiday_call})[0] || {})[:name]\n"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
src
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
def decorate_options(options)
|
|
30
|
+
options.map do |o|
|
|
31
|
+
o.to_sym
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require 'holidays/errors'
|
|
2
|
+
|
|
3
|
+
module Holidays
|
|
4
|
+
module Definition
|
|
5
|
+
module Generator
|
|
6
|
+
class Test
|
|
7
|
+
def initialize(decorator)
|
|
8
|
+
@decorator = decorator
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def call(module_name, file_names, tests)
|
|
12
|
+
validate!(module_name, file_names, tests)
|
|
13
|
+
|
|
14
|
+
test_src =<<-EndOfTests
|
|
15
|
+
# encoding: utf-8
|
|
16
|
+
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
|
17
|
+
|
|
18
|
+
# This file is generated by the Ruby Holiday gem.
|
|
19
|
+
#
|
|
20
|
+
# Definitions loaded: #{file_names.join(', ')}
|
|
21
|
+
class #{module_name.to_s.capitalize}DefinitionTests < Test::Unit::TestCase # :nodoc:
|
|
22
|
+
|
|
23
|
+
def test_#{module_name.to_s.downcase}#{decorate(tests)}
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
EndOfTests
|
|
27
|
+
|
|
28
|
+
test_src
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def validate!(module_name, file_names, tests)
|
|
34
|
+
raise ArgumentError.new("module_name cannot be missing") if module_name.nil? || module_name.empty?
|
|
35
|
+
raise ArgumentError.new("file_names for '#{module_name}' cannot be missing") if file_names.nil? || file_names.empty?
|
|
36
|
+
raise ArgumentError.new("tests for '#{module_name}' cannot be missing") if tests.nil?
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def decorate(tests)
|
|
40
|
+
out = ""
|
|
41
|
+
|
|
42
|
+
tests.each do |t|
|
|
43
|
+
out << "\n " + @decorator.call(t)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
out
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
require 'holidays/definition/entity/test'
|
|
2
|
+
|
|
3
|
+
module Holidays
|
|
4
|
+
module Definition
|
|
5
|
+
module Parser
|
|
6
|
+
class Test
|
|
7
|
+
def initialize(validator)
|
|
8
|
+
@validator = validator
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def call(tests)
|
|
12
|
+
return [] if tests.nil?
|
|
13
|
+
|
|
14
|
+
validate!(tests)
|
|
15
|
+
|
|
16
|
+
tests.map do |t|
|
|
17
|
+
given = t["given"]
|
|
18
|
+
expect = t["expect"]
|
|
19
|
+
|
|
20
|
+
Entity::Test.new(
|
|
21
|
+
dates: parse_dates(given["date"]),
|
|
22
|
+
regions: parse_regions(given["regions"]),
|
|
23
|
+
options: parse_options(given["options"]),
|
|
24
|
+
name: expect["name"],
|
|
25
|
+
holiday?: is_holiday?(expect["holiday"]),
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
private
|
|
31
|
+
|
|
32
|
+
def validate!(tests)
|
|
33
|
+
raise ArgumentError unless tests.all? do |t|
|
|
34
|
+
dates = t["given"]["date"]
|
|
35
|
+
unless dates.is_a?(Array)
|
|
36
|
+
dates = [ dates ]
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
@validator.valid?(
|
|
40
|
+
{
|
|
41
|
+
:dates => dates,
|
|
42
|
+
:regions => t["given"]["regions"],
|
|
43
|
+
:options => t["given"]["options"],
|
|
44
|
+
:name => t["expect"]["name"],
|
|
45
|
+
:holiday => t["expect"]["holiday"],
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def parse_dates(dates)
|
|
52
|
+
unless dates.is_a?(Array)
|
|
53
|
+
dates = [ dates ]
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
dates.map do |d|
|
|
57
|
+
DateTime.parse(d)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def parse_regions(regions)
|
|
62
|
+
regions.map do |r|
|
|
63
|
+
r.to_sym
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def parse_options(options)
|
|
68
|
+
if options
|
|
69
|
+
if options.is_a?(Array)
|
|
70
|
+
options.map do |o|
|
|
71
|
+
o.to_sym
|
|
72
|
+
end
|
|
73
|
+
else
|
|
74
|
+
[ options.to_sym ]
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# If flag is not present then default to 'true'
|
|
80
|
+
def is_holiday?(flag)
|
|
81
|
+
flag.nil? ? true : !!flag
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
module Holidays
|
|
2
|
+
module Definition
|
|
3
|
+
module Validator
|
|
4
|
+
class Test
|
|
5
|
+
def valid?(t)
|
|
6
|
+
valid_dates?(t[:dates]) &&
|
|
7
|
+
valid_regions?(t[:regions]) &&
|
|
8
|
+
valid_name?(t[:name]) &&
|
|
9
|
+
valid_holiday?(t[:holiday]) &&
|
|
10
|
+
valid_options?(t[:options]) &&
|
|
11
|
+
required_fields?(t)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def valid_dates?(dates)
|
|
17
|
+
return false unless dates
|
|
18
|
+
|
|
19
|
+
dates.all? do |d|
|
|
20
|
+
begin
|
|
21
|
+
DateTime.parse(d)
|
|
22
|
+
true
|
|
23
|
+
rescue TypeError, ArgumentError
|
|
24
|
+
false
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def valid_regions?(regions)
|
|
30
|
+
return false unless regions
|
|
31
|
+
|
|
32
|
+
regions.all? do |r|
|
|
33
|
+
r.is_a?(String)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Can be missing
|
|
38
|
+
def valid_name?(n)
|
|
39
|
+
return true unless n
|
|
40
|
+
n.is_a?(String)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Can be missing
|
|
44
|
+
def valid_holiday?(h)
|
|
45
|
+
return true unless h
|
|
46
|
+
h.is_a?(TrueClass)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Okay to be missing and can be either string or array of strings
|
|
50
|
+
def valid_options?(options)
|
|
51
|
+
return true unless options
|
|
52
|
+
|
|
53
|
+
if options.is_a?(Array)
|
|
54
|
+
options.all? do |o|
|
|
55
|
+
o.is_a?(String)
|
|
56
|
+
end
|
|
57
|
+
elsif options.is_a?(String)
|
|
58
|
+
true
|
|
59
|
+
else
|
|
60
|
+
false
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def required_fields?(t)
|
|
65
|
+
return false if t[:name].nil? && t[:holiday].nil?
|
|
66
|
+
true
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
data/lib/holidays/errors.rb
CHANGED
|
@@ -4,8 +4,11 @@ require 'holidays/definition/context/function_processor'
|
|
|
4
4
|
require 'holidays/definition/context/load'
|
|
5
5
|
require 'holidays/definition/decorator/custom_method_proc'
|
|
6
6
|
require 'holidays/definition/decorator/custom_method_source'
|
|
7
|
+
require 'holidays/definition/decorator/test'
|
|
7
8
|
require 'holidays/definition/generator/regions'
|
|
9
|
+
require 'holidays/definition/generator/test'
|
|
8
10
|
require 'holidays/definition/parser/custom_method'
|
|
11
|
+
require 'holidays/definition/parser/test'
|
|
9
12
|
require 'holidays/definition/repository/holidays_by_month'
|
|
10
13
|
require 'holidays/definition/repository/regions'
|
|
11
14
|
require 'holidays/definition/repository/cache'
|
|
@@ -13,6 +16,7 @@ require 'holidays/definition/repository/proc_result_cache'
|
|
|
13
16
|
require 'holidays/definition/repository/custom_methods'
|
|
14
17
|
require 'holidays/definition/validator/custom_method'
|
|
15
18
|
require 'holidays/definition/validator/region'
|
|
19
|
+
require 'holidays/definition/validator/test'
|
|
16
20
|
|
|
17
21
|
module Holidays
|
|
18
22
|
module Factory
|
|
@@ -23,6 +27,8 @@ module Holidays
|
|
|
23
27
|
custom_method_parser,
|
|
24
28
|
custom_method_source_decorator,
|
|
25
29
|
custom_methods_repository,
|
|
30
|
+
test_parser,
|
|
31
|
+
test_generator,
|
|
26
32
|
)
|
|
27
33
|
end
|
|
28
34
|
|
|
@@ -31,6 +37,8 @@ module Holidays
|
|
|
31
37
|
custom_method_parser,
|
|
32
38
|
custom_method_source_decorator,
|
|
33
39
|
custom_methods_repository,
|
|
40
|
+
test_parser,
|
|
41
|
+
test_generator,
|
|
34
42
|
)
|
|
35
43
|
end
|
|
36
44
|
|
|
@@ -106,6 +114,22 @@ module Holidays
|
|
|
106
114
|
Holidays::FULL_DEFINITIONS_PATH,
|
|
107
115
|
)
|
|
108
116
|
end
|
|
117
|
+
|
|
118
|
+
def test_generator
|
|
119
|
+
Holidays::Definition::Generator::Test.new(
|
|
120
|
+
test_decorator,
|
|
121
|
+
)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def test_decorator
|
|
125
|
+
Holidays::Definition::Decorator::Test.new
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def test_parser
|
|
129
|
+
Holidays::Definition::Parser::Test.new(
|
|
130
|
+
Holidays::Definition::Validator::Test.new,
|
|
131
|
+
)
|
|
132
|
+
end
|
|
109
133
|
end
|
|
110
134
|
end
|
|
111
135
|
end
|