feriados 4.0.0 → 4.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/feriados.rb +4 -2
- data/lib/feriados/calendar.rb +29 -3
- data/lib/feriados/loader.rb +20 -0
- data/lib/feriados/rules.rb +46 -115
- data/lib/feriados/rules/carnival_monday.rb +9 -0
- data/lib/feriados/rules/carnival_tuesday.rb +9 -0
- data/lib/feriados/rules/day_of_month.rb +23 -0
- data/lib/feriados/rules/day_of_week.rb +22 -0
- data/lib/feriados/rules/easter.rb +78 -0
- data/lib/feriados/rules/fix_date.rb +24 -0
- data/lib/feriados/rules/fix_week_day.rb +25 -0
- data/lib/feriados/rules/function.rb +9 -0
- data/lib/feriados/rules/holy_friday.rb +9 -0
- data/lib/feriados/rules/holy_thursday.rb +9 -0
- data/lib/feriados/rules/rule_base.rb +23 -0
- data/test/date_test.rb +2 -1
- data/test/day_of_month_test.rb +63 -0
- data/test/day_off_week_test.rb +71 -0
- data/test/easter_test.rb +52 -0
- data/test/feriados_test.rb +42 -263
- data/test/fix_date_test.rb +59 -0
- data/test/fix_week_day_test.rb +48 -0
- data/test/holy_friday_test.rb +52 -0
- data/test/holy_thursday_test.rb +28 -0
- data/test/runner.rb +1 -1
- data/test/test_helper.rb +4 -4
- metadata +60 -8
- data/lib/feriados/argentina.rb +0 -49
@@ -0,0 +1,25 @@
|
|
1
|
+
module Feriados
|
2
|
+
module Rules
|
3
|
+
class FixWeekDay < RuleBase
|
4
|
+
def initialize(week, wday, month, name = nil)
|
5
|
+
super(name)
|
6
|
+
@week = week
|
7
|
+
@wday = wday
|
8
|
+
@month = month
|
9
|
+
end
|
10
|
+
|
11
|
+
def holiday?(date)
|
12
|
+
date_from_week = (date.day - 1) / 7 + 1
|
13
|
+
wday == date.wday && month == date.month && week == date_from_week
|
14
|
+
end
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
attr_reader :week, :wday, :month
|
19
|
+
|
20
|
+
def state
|
21
|
+
[week, wday, month]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Feriados
|
2
|
+
module Rules
|
3
|
+
class RuleBase
|
4
|
+
attr_reader :name
|
5
|
+
|
6
|
+
def initialize(name = nil)
|
7
|
+
@name = name
|
8
|
+
end
|
9
|
+
|
10
|
+
def hash
|
11
|
+
state.hash
|
12
|
+
end
|
13
|
+
|
14
|
+
def eql?(other)
|
15
|
+
hash == other.hash
|
16
|
+
end
|
17
|
+
|
18
|
+
def ==(other)
|
19
|
+
eql?(other)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/test/date_test.rb
CHANGED
@@ -11,10 +11,11 @@ class DateTest < Minitest::Test
|
|
11
11
|
|
12
12
|
date = Date.new(2016, 5, 2)
|
13
13
|
|
14
|
-
calendar.add(FixDate.new(date.year, date.month, date.day))
|
14
|
+
calendar.add(FixDate.new(date.year, date.month, date.day, 'Bridge'))
|
15
15
|
|
16
16
|
assert calendar.holiday?(date)
|
17
17
|
|
18
18
|
assert date.holiday?
|
19
|
+
assert_equal date.holiday_name, 'Bridge'
|
19
20
|
end
|
20
21
|
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class DayOfMonthTest < Minitest::Test
|
4
|
+
include Feriados::Rules
|
5
|
+
include Feriados
|
6
|
+
|
7
|
+
def test_a_date_of_month_can_be_a_holiday
|
8
|
+
calendar = Calendar.new
|
9
|
+
|
10
|
+
a_january_first = Date.new(2016, 1, 1)
|
11
|
+
|
12
|
+
calendar.add(DayOfMonth.new(1, 1))
|
13
|
+
|
14
|
+
assert calendar.holiday?(a_january_first)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_a_date_of_month_can_have_a_name
|
18
|
+
calendar = Calendar.new
|
19
|
+
|
20
|
+
a_january_first = Date.new(2016, 1, 1)
|
21
|
+
|
22
|
+
calendar.add(DayOfMonth.new(1, 1, 'new year'))
|
23
|
+
|
24
|
+
assert_equal 'new year', calendar.holiday_name(a_january_first)
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_a_day_of_month_can_be_not_a_holiday
|
28
|
+
calendar = Calendar.new
|
29
|
+
|
30
|
+
a_day = Date.new(2016, 1, 2)
|
31
|
+
|
32
|
+
calendar.add(DayOfMonth.new(1, 1))
|
33
|
+
|
34
|
+
refute calendar.holiday?(a_day)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_a_bunch_of_days_of_month_can_be_a_holiday
|
38
|
+
calendar = Calendar.new
|
39
|
+
|
40
|
+
a_christmas = Date.new(2016, 12, 25)
|
41
|
+
a_january_first = Date.new(2016, 1, 1)
|
42
|
+
|
43
|
+
calendar.add(DayOfMonth.new(1, 1))
|
44
|
+
calendar.add(DayOfMonth.new(25, 12))
|
45
|
+
|
46
|
+
assert calendar.holiday?(a_christmas)
|
47
|
+
assert calendar.holiday?(a_january_first)
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_a_day_of_month_rule_can_be_deleted
|
51
|
+
calendar = Calendar.new
|
52
|
+
|
53
|
+
date = Date.new(2016, 5, 1)
|
54
|
+
|
55
|
+
calendar.add(DayOfMonth.new(date.day, date.month))
|
56
|
+
|
57
|
+
assert calendar.holiday?(date)
|
58
|
+
|
59
|
+
calendar.remove(DayOfMonth.new(date.day, date.month))
|
60
|
+
|
61
|
+
refute calendar.holiday?(date)
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class DayOfWeekTest < Minitest::Test
|
4
|
+
include Feriados::Rules
|
5
|
+
include Feriados
|
6
|
+
|
7
|
+
def test_a_day_of_week_can_be_a_holiday
|
8
|
+
calendar = Calendar.new
|
9
|
+
|
10
|
+
a_saturday = Date.new(2016, 4, 30)
|
11
|
+
|
12
|
+
calendar.add(DayOfWeek.new(a_saturday.wday))
|
13
|
+
|
14
|
+
assert calendar.holiday?(a_saturday)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_a_day_of_week_can__a_name
|
18
|
+
calendar = Calendar.new
|
19
|
+
|
20
|
+
a_saturday = Date.new(2016, 4, 30)
|
21
|
+
|
22
|
+
calendar.add(DayOfWeek.new(a_saturday.wday, 'saturday night live'))
|
23
|
+
|
24
|
+
assert_equal 'saturday night live', calendar.holiday_name(a_saturday)
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_a_day_of_week_with_no_a_name
|
28
|
+
calendar = Calendar.new
|
29
|
+
|
30
|
+
a_saturday = Date.new(2016, 4, 30)
|
31
|
+
|
32
|
+
calendar.add(DayOfWeek.new(a_saturday.wday))
|
33
|
+
|
34
|
+
assert_nil calendar.holiday_name(a_saturday)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_a_day_of_week_can_be_not_a_holiday
|
38
|
+
calendar = Calendar.new
|
39
|
+
|
40
|
+
a_monday = Date.new(2016, 5, 2)
|
41
|
+
|
42
|
+
refute calendar.holiday?(a_monday)
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_a_bunch_of_days_can_be_a_holiday
|
46
|
+
calendar = Calendar.new
|
47
|
+
|
48
|
+
a_saturday = Date.new(2016, 4, 30)
|
49
|
+
a_sunday = Date.new(2016, 5, 1)
|
50
|
+
|
51
|
+
calendar.add(DayOfWeek.new(a_saturday.wday))
|
52
|
+
calendar.add(DayOfWeek.new(a_sunday.wday))
|
53
|
+
|
54
|
+
assert calendar.holiday?(a_sunday)
|
55
|
+
assert calendar.holiday?(a_saturday)
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_a_day_of_week_rule_can_be_deleted
|
59
|
+
calendar = Calendar.new
|
60
|
+
|
61
|
+
date = Date.new(2016, 5, 1)
|
62
|
+
|
63
|
+
calendar.add(DayOfWeek.new(date.wday))
|
64
|
+
|
65
|
+
assert calendar.holiday?(date)
|
66
|
+
|
67
|
+
calendar.remove(DayOfWeek.new(date.wday))
|
68
|
+
|
69
|
+
refute calendar.holiday?(date)
|
70
|
+
end
|
71
|
+
end
|
data/test/easter_test.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class EasterTest < Minitest::Test
|
4
|
+
include Feriados::Rules
|
5
|
+
include Feriados
|
6
|
+
|
7
|
+
def test_easter
|
8
|
+
calendar = Calendar.new
|
9
|
+
|
10
|
+
date = Date.new(2016, 3, 27)
|
11
|
+
|
12
|
+
calendar.add(Easter)
|
13
|
+
|
14
|
+
assert calendar.holiday?(date)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_easter_can_have_name
|
18
|
+
calendar = Calendar.new
|
19
|
+
|
20
|
+
date = Date.new(2016, 3, 27)
|
21
|
+
|
22
|
+
Easter.name = 'pascua'
|
23
|
+
|
24
|
+
calendar.add(Easter)
|
25
|
+
|
26
|
+
assert_equal 'pascua', calendar.holiday_name(date)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_not_easter
|
30
|
+
calendar = Calendar.new
|
31
|
+
|
32
|
+
date = Date.new(2016, 3, 26)
|
33
|
+
|
34
|
+
calendar.add(Easter)
|
35
|
+
|
36
|
+
refute calendar.holiday?(date)
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_remove_easter
|
40
|
+
calendar = Calendar.new
|
41
|
+
|
42
|
+
date = Date.new(2016, 3, 27)
|
43
|
+
|
44
|
+
calendar.add(Easter)
|
45
|
+
|
46
|
+
assert calendar.holiday?(date)
|
47
|
+
|
48
|
+
calendar.remove(Easter)
|
49
|
+
|
50
|
+
refute calendar.holiday?(date)
|
51
|
+
end
|
52
|
+
end
|
data/test/feriados_test.rb
CHANGED
@@ -4,284 +4,63 @@ class CalendarTest < Minitest::Test
|
|
4
4
|
include Feriados::Rules
|
5
5
|
include Feriados
|
6
6
|
|
7
|
-
def
|
8
|
-
calendar = Calendar.new
|
9
|
-
|
10
|
-
a_saturday = Date.new(2016, 4, 30)
|
11
|
-
|
12
|
-
calendar.add(DayOfWeek.new(a_saturday.wday))
|
13
|
-
|
14
|
-
assert calendar.holiday?(a_saturday)
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_a_day_of_week_can_be_not_a_holiday
|
18
|
-
calendar = Calendar.new
|
19
|
-
|
20
|
-
a_monday = Date.new(2016, 5, 2)
|
21
|
-
|
22
|
-
refute calendar.holiday?(a_monday)
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_a_bunch_of_days_can_be_a_holiday
|
26
|
-
calendar = Calendar.new
|
27
|
-
|
28
|
-
a_saturday = Date.new(2016, 4, 30)
|
29
|
-
a_sunday = Date.new(2016, 5, 1)
|
30
|
-
|
31
|
-
calendar.add(DayOfWeek.new(a_saturday.wday))
|
32
|
-
calendar.add(DayOfWeek.new(a_sunday.wday))
|
33
|
-
|
34
|
-
assert calendar.holiday?(a_sunday)
|
35
|
-
assert calendar.holiday?(a_saturday)
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_a_day_of_week_rule_can_be_deleted
|
39
|
-
calendar = Calendar.new
|
40
|
-
|
41
|
-
date = Date.new(2016, 5, 1)
|
42
|
-
|
43
|
-
calendar.add(DayOfWeek.new(date.wday))
|
44
|
-
|
45
|
-
assert calendar.holiday?(date)
|
46
|
-
|
47
|
-
calendar.remove(DayOfWeek.new(date.wday))
|
48
|
-
|
49
|
-
refute calendar.holiday?(date)
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_a_date_of_month_can_be_a_holiday
|
53
|
-
calendar = Calendar.new
|
54
|
-
|
55
|
-
a_january_first = Date.new(2016, 1, 1)
|
56
|
-
|
57
|
-
calendar.add(DayOfMonth.new(1, 1))
|
58
|
-
|
59
|
-
assert calendar.holiday?(a_january_first)
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_a_day_of_month_can_be_not_a_holiday
|
63
|
-
calendar = Calendar.new
|
64
|
-
|
65
|
-
a_day = Date.new(2016, 1, 2)
|
66
|
-
|
67
|
-
calendar.add(DayOfMonth.new(1, 1))
|
68
|
-
|
69
|
-
refute calendar.holiday?(a_day)
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_a_bunch_of_days_of_month_can_be_a_holiday
|
73
|
-
calendar = Calendar.new
|
74
|
-
|
75
|
-
a_christmas = Date.new(2016, 12, 25)
|
76
|
-
a_january_first = Date.new(2016, 1, 1)
|
77
|
-
|
78
|
-
calendar.add(DayOfMonth.new(1, 1))
|
79
|
-
calendar.add(DayOfMonth.new(25, 12))
|
80
|
-
|
81
|
-
assert calendar.holiday?(a_christmas)
|
82
|
-
assert calendar.holiday?(a_january_first)
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_a_day_of_month_rule_can_be_deleted
|
86
|
-
calendar = Calendar.new
|
87
|
-
|
88
|
-
date = Date.new(2016, 5, 1)
|
89
|
-
|
90
|
-
calendar.add(DayOfMonth.new(date.day, date.month))
|
91
|
-
|
92
|
-
assert calendar.holiday?(date)
|
93
|
-
|
94
|
-
calendar.remove(DayOfMonth.new(date.day, date.month))
|
95
|
-
|
96
|
-
refute calendar.holiday?(date)
|
97
|
-
end
|
98
|
-
|
99
|
-
def test_a_date_can_be_a_holiday
|
100
|
-
calendar = Calendar.new
|
101
|
-
|
102
|
-
date = Date.new(2016, 1, 1)
|
103
|
-
|
104
|
-
calendar.add(FixDate.new(2016, 1, 1))
|
105
|
-
|
106
|
-
assert calendar.holiday?(date)
|
107
|
-
end
|
108
|
-
|
109
|
-
def test_a_date_can_be_not_a_holiday
|
110
|
-
calendar = Calendar.new
|
111
|
-
|
112
|
-
refute calendar.holiday?(Date.new(2016, 1, 1))
|
113
|
-
end
|
114
|
-
|
115
|
-
def test_a_bunch_of_dates_can_be_a_holiday
|
116
|
-
calendar = Calendar.new
|
117
|
-
|
118
|
-
date = Date.new(2016, 4, 29)
|
119
|
-
another_date = Date.new(2016, 4, 30)
|
120
|
-
|
121
|
-
calendar.add(FixDate.new(2016, 4, 29))
|
122
|
-
calendar.add(FixDate.new(2016, 4, 30))
|
123
|
-
|
124
|
-
assert calendar.holiday?(date)
|
125
|
-
assert calendar.holiday?(another_date)
|
126
|
-
end
|
127
|
-
|
128
|
-
def test_a_date_rule_can_be_deleted
|
129
|
-
calendar = Calendar.new
|
130
|
-
|
131
|
-
date = Date.new(2016, 5, 1)
|
132
|
-
|
133
|
-
calendar.add(FixDate.new(date.year, date.month, date.day))
|
134
|
-
|
135
|
-
assert calendar.holiday?(date)
|
136
|
-
|
137
|
-
calendar.remove(FixDate.new(date.year, date.month, date.day))
|
138
|
-
|
139
|
-
refute calendar.holiday?(date)
|
140
|
-
end
|
141
|
-
|
142
|
-
def test_easter
|
143
|
-
calendar = Calendar.new
|
144
|
-
|
145
|
-
date = Date.new(2016, 3, 27)
|
146
|
-
|
147
|
-
calendar.add(Easter)
|
148
|
-
|
149
|
-
assert calendar.holiday?(date)
|
150
|
-
end
|
151
|
-
|
152
|
-
def test_not_easter
|
153
|
-
calendar = Calendar.new
|
154
|
-
|
155
|
-
date = Date.new(2016, 3, 26)
|
156
|
-
|
157
|
-
calendar.add(Easter)
|
158
|
-
|
159
|
-
refute calendar.holiday?(date)
|
160
|
-
end
|
161
|
-
|
162
|
-
def test_remove_easter
|
163
|
-
calendar = Calendar.new
|
164
|
-
|
165
|
-
date = Date.new(2016, 3, 27)
|
166
|
-
|
167
|
-
calendar.add(Easter)
|
168
|
-
|
169
|
-
assert calendar.holiday?(date)
|
170
|
-
|
171
|
-
calendar.remove(Easter)
|
172
|
-
|
173
|
-
refute calendar.holiday?(date)
|
174
|
-
end
|
175
|
-
|
176
|
-
def test_holy_friday
|
177
|
-
calendar = Calendar.new
|
178
|
-
|
179
|
-
date = Date.new(2016, 3, 25)
|
180
|
-
|
181
|
-
calendar.add(HolyFriday)
|
182
|
-
|
183
|
-
assert calendar.holiday?(date)
|
184
|
-
end
|
185
|
-
|
186
|
-
def test_not_holy_friday
|
187
|
-
calendar = Calendar.new
|
188
|
-
|
189
|
-
date = Date.new(2016, 3, 20)
|
190
|
-
|
191
|
-
calendar.add(HolyFriday)
|
192
|
-
|
193
|
-
refute calendar.holiday?(date)
|
194
|
-
end
|
195
|
-
|
196
|
-
def test_remove_holy_friday
|
197
|
-
calendar = Calendar.new
|
198
|
-
|
199
|
-
date = Date.new(2016, 3, 25)
|
200
|
-
|
201
|
-
calendar.add(HolyFriday)
|
202
|
-
|
203
|
-
assert calendar.holiday?(date)
|
204
|
-
|
205
|
-
calendar.remove(HolyFriday)
|
206
|
-
|
207
|
-
refute calendar.holiday?(date)
|
208
|
-
end
|
209
|
-
|
210
|
-
def test_holy_thursday
|
7
|
+
def test_load_argentinian_holidays
|
211
8
|
calendar = Calendar.new
|
212
9
|
|
213
|
-
|
10
|
+
file = File.join(__dir__, './argentina.yml')
|
11
|
+
rules = YAML.load_file(file)
|
214
12
|
|
215
|
-
calendar.
|
216
|
-
|
217
|
-
assert calendar.holiday?(date)
|
218
|
-
end
|
13
|
+
calendar.load(rules)
|
219
14
|
|
220
|
-
|
221
|
-
|
15
|
+
holidays2020_data = [
|
16
|
+
[1, 1, 'Año nuevo'],
|
17
|
+
[2, 24, 'Lunes de carnaval'],
|
18
|
+
[2, 25, 'Martes de carnaval'],
|
19
|
+
[3, 23, 'Feriado con fines turísticos'],
|
20
|
+
[3, 24, 'Día Nacional de la Memoria por la Verdad y la Justicia'],
|
21
|
+
[4, 2, 'Día del Veterano y de los Caídos en la Guerra de Malvinas'],
|
22
|
+
[4, 9, 'Jueves Santo'],
|
23
|
+
[4, 10, 'Viernes Santo'],
|
24
|
+
[4, 12, 'Pascua'],
|
25
|
+
[5, 1, 'Día del Trabajador'],
|
26
|
+
[5, 25, 'Día de la Revolución de Mayo'],
|
27
|
+
[6, 15, 'Día Paso a la Inmortalidad del General Martín Miguel de Güemes'],
|
28
|
+
[6, 20, 'Día de la Bandera'],
|
29
|
+
[7, 9, 'Día de la Independencia'],
|
30
|
+
[7, 10, 'Feriado con fines turísticos'],
|
31
|
+
[8, 17, 'Paso a la Inmortalidad del Gral. José de San Martín'],
|
32
|
+
[10, 12, 'Día del Respeto a la Diversidad Cultural'],
|
33
|
+
[11, 23, 'Día de la Soberanía Nacional'],
|
34
|
+
[12, 7, 'Feriado con fines turísticos'],
|
35
|
+
[12, 8, 'Inmaculada Concepción de María'],
|
36
|
+
[12, 25, 'Navidad']
|
37
|
+
]
|
222
38
|
|
223
|
-
|
224
|
-
|
39
|
+
holidays2020_data.each do |month, day, description|
|
40
|
+
date = Date.new(2020, month, day)
|
225
41
|
|
226
|
-
|
227
|
-
assert calendar.holiday?(Date.new(2016, 8, 15))
|
228
|
-
end
|
42
|
+
assert calendar.holiday?(date), date
|
229
43
|
|
230
|
-
|
231
|
-
|
44
|
+
assert_equal description, calendar.holiday_name(date), date
|
45
|
+
end
|
232
46
|
|
233
|
-
date = Date.new(
|
47
|
+
date = Date.new(2020, 1, 1)
|
48
|
+
detected_holidays = []
|
234
49
|
|
235
|
-
|
50
|
+
0.upto(365) do |day|
|
51
|
+
detected_holidays << calendar.holiday?(date + day)
|
52
|
+
end
|
236
53
|
|
237
|
-
|
54
|
+
assert_equal(holidays2020_data.count, detected_holidays.count { |e| e })
|
238
55
|
end
|
239
56
|
|
240
|
-
def
|
241
|
-
|
242
|
-
|
243
|
-
date = Date.new(2016, 11, 28)
|
244
|
-
|
245
|
-
calendar.add(FixWeekDay.new(4, 1, 11))
|
246
|
-
|
247
|
-
assert calendar.holiday?(date)
|
57
|
+
def test_load_incomplete_rules
|
58
|
+
rules = {}
|
248
59
|
|
249
|
-
calendar.remove(FixWeekDay.new(4, 1, 11))
|
250
|
-
|
251
|
-
refute calendar.holiday?(date)
|
252
|
-
end
|
253
|
-
|
254
|
-
def test_load_argentinian_holidays
|
255
60
|
calendar = Calendar.new
|
256
61
|
|
257
|
-
|
258
|
-
|
259
|
-
assert calendar.holiday?(Date.new(2016, 1, 1))
|
260
|
-
|
261
|
-
assert calendar.holiday?(Date.new(2016, 2, 8))
|
262
|
-
assert calendar.holiday?(Date.new(2016, 2, 9))
|
263
|
-
|
264
|
-
assert calendar.holiday?(Date.new(2016, 3, 24))
|
265
|
-
assert calendar.holiday?(Date.new(2016, 3, 25))
|
266
|
-
assert calendar.holiday?(Date.new(2016, 3, 27))
|
267
|
-
|
268
|
-
assert calendar.holiday?(Date.new(2016, 4, 2))
|
269
|
-
|
270
|
-
assert calendar.holiday?(Date.new(2016, 5, 1))
|
271
|
-
assert calendar.holiday?(Date.new(2016, 5, 25))
|
272
|
-
|
273
|
-
assert calendar.holiday?(Date.new(2016, 6, 20))
|
274
|
-
|
275
|
-
assert calendar.holiday?(Date.new(2016, 7, 8))
|
276
|
-
assert calendar.holiday?(Date.new(2016, 7, 9))
|
277
|
-
|
278
|
-
assert calendar.holiday?(Date.new(2016, 8, 15))
|
279
|
-
|
280
|
-
assert calendar.holiday?(Date.new(2016, 10, 10))
|
281
|
-
|
282
|
-
assert calendar.holiday?(Date.new(2016, 11, 28))
|
62
|
+
calendar.load(rules)
|
283
63
|
|
284
|
-
|
285
|
-
assert calendar.holiday?(Date.new(2016, 12, 25))
|
64
|
+
assert_equal calendar, Calendar.new
|
286
65
|
end
|
287
66
|
end
|