us_bank_holidays 0.2.0 → 0.2.1
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8db39160147df2816e65af1fd851ff2fdc9488bdc189101c7bc03e86395a0189
|
4
|
+
data.tar.gz: ad4e2585e1539f8d82e8f1b11dd1b10b9625c57f019e85944a1b961baf699af9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f4933efb849b3df1673ccf858494d9ba183baa980193a980a15ccb0adf51d3527b42ce4a8c93a23bb402b0399f0510d14aaebf6c38f0a8b875a6172b7f43703
|
7
|
+
data.tar.gz: b78c5d1a86ae39a7307155580d8c33b15d0feb317fee9a680a1fbb7bcb20ee60a14b2e7444d11020937b2a5222bd1f31ec3cd2cdbf6c4028d18badd6ace3973f
|
@@ -43,7 +43,7 @@ module UsBankHolidays
|
|
43
43
|
thanksgiving,
|
44
44
|
christmas
|
45
45
|
].compact
|
46
|
-
if Date.new(year + 1, 1, 1).saturday?
|
46
|
+
if Date.new(year + 1, 1, 1).saturday? && ::UsBankHolidays.saturday_holiday_date_rolling?
|
47
47
|
holidays << Date.new(year, 12, 31)
|
48
48
|
end
|
49
49
|
holidays.freeze
|
@@ -53,6 +53,7 @@ RSpec.describe UsBankHolidays::HolidayYear do
|
|
53
53
|
context "2021 and later" do
|
54
54
|
|
55
55
|
context "Force Saturday date rolling" do
|
56
|
+
|
56
57
|
before :each do
|
57
58
|
allow(::UsBankHolidays).to receive(:saturday_holiday_date_rolling?).and_return(true)
|
58
59
|
end
|
@@ -78,6 +79,10 @@ RSpec.describe UsBankHolidays::HolidayYear do
|
|
78
79
|
end
|
79
80
|
|
80
81
|
context "No Saturday date rolling" do
|
82
|
+
before :each do
|
83
|
+
allow(::UsBankHolidays).to receive(:saturday_holiday_date_rolling?).and_return(false)
|
84
|
+
end
|
85
|
+
|
81
86
|
it 'should determine bank holidays' do
|
82
87
|
expect(UsBankHolidays::HolidayYear.new(2021).bank_holidays).to eq([
|
83
88
|
'2021-01-01', #New Year’s Day
|
@@ -90,8 +95,7 @@ RSpec.describe UsBankHolidays::HolidayYear do
|
|
90
95
|
'2021-10-11', #Columbus Day
|
91
96
|
'2021-11-11', #Veterans Day
|
92
97
|
'2021-11-25', #Thanksgiving Day
|
93
|
-
'2021-12-25'
|
94
|
-
'2021-12-31' #New Year’s Day
|
98
|
+
'2021-12-25' #Christmas Day
|
95
99
|
].map { |d| Date.parse(d) }
|
96
100
|
)
|
97
101
|
end
|
@@ -102,10 +106,6 @@ RSpec.describe UsBankHolidays::HolidayYear do
|
|
102
106
|
|
103
107
|
end
|
104
108
|
|
105
|
-
it 'should declare Dec. 31 a bank holiday if it falls on a Friday' do
|
106
|
-
UsBankHolidays::HolidayYear.new(2021).bank_holidays.last.should == Date.new(2021, 12, 31)
|
107
|
-
end
|
108
|
-
|
109
109
|
context 'Months' do
|
110
110
|
let(:year) { UsBankHolidays::HolidayYear.new(2014) }
|
111
111
|
|
@@ -1,245 +1,282 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
RSpec.describe UsBankHolidays do
|
4
|
-
let(:sample_holidays) {
|
5
|
-
[
|
6
|
-
'2014-01-01', #New Year’s Day
|
7
|
-
'2014-01-20', #Birthday of Martin Luther King, Jr.
|
8
|
-
'2014-02-17', #Washington’s Birthday
|
9
|
-
'2014-05-26', #Memorial Day
|
10
|
-
'2014-07-04', #Independence Day
|
11
|
-
'2014-09-01', #Labor Day
|
12
|
-
'2014-10-13', #Columbus Day
|
13
|
-
'2014-11-11', #Veterans Day
|
14
|
-
'2014-11-27', #Thanksgiving Day
|
15
|
-
'2014-12-25', #Christmas Day
|
16
|
-
|
17
|
-
'2015-01-01', #New Year’s Day
|
18
|
-
'2015-01-19', #Birthday of Martin Luther King, Jr.
|
19
|
-
'2015-02-16', #Washington’s Birthday
|
20
|
-
'2015-05-25', #Memorial Day
|
21
|
-
'2015-07-03', #Independence Day
|
22
|
-
'2015-09-07', #Labor Day
|
23
|
-
'2015-10-12', #Columbus Day
|
24
|
-
'2015-11-11', #Veterans Day
|
25
|
-
'2015-11-26', #Thanksgiving Day
|
26
|
-
'2015-12-25', #Christmas Day
|
27
|
-
|
28
|
-
'2016-01-01', #New Year’s Day
|
29
|
-
'2016-01-18', #Birthday of Martin Luther King, Jr.
|
30
|
-
'2016-02-15', #Washington’s Birthday
|
31
|
-
'2016-05-30', #Memorial Day
|
32
|
-
'2016-07-04', #Independence Day
|
33
|
-
'2016-09-05', #Labor Day
|
34
|
-
'2016-10-10', #Columbus Day
|
35
|
-
'2016-11-11', #Veterans Day
|
36
|
-
'2016-11-24', #Thanksgiving Day
|
37
|
-
'2016-12-26', #Christmas Day
|
38
|
-
|
39
|
-
'2017-01-02', #New Year’s Day
|
40
|
-
'2017-01-16', #Birthday of Martin Luther King, Jr.
|
41
|
-
'2017-02-20', #Washington’s Birthday
|
42
|
-
'2017-05-29', #Memorial Day
|
43
|
-
'2017-07-04', #Independence Day
|
44
|
-
'2017-09-04', #Labor Day
|
45
|
-
'2017-10-09', #Columbus Day
|
46
|
-
'2017-11-10', #Veterans Day
|
47
|
-
'2017-11-23', #Thanksgiving Day
|
48
|
-
'2017-12-25', #Christmas Day
|
49
|
-
|
50
|
-
'2018-01-01', #New Year’s Day
|
51
|
-
'2018-01-15', #Birthday of Martin Luther King, Jr.
|
52
|
-
'2018-02-19', #Washington’s Birthday
|
53
|
-
'2018-05-28', #Memorial Day
|
54
|
-
'2018-07-04', #Independence Day
|
55
|
-
'2018-09-03', #Labor Day
|
56
|
-
'2018-10-08', #Columbus Day
|
57
|
-
'2018-11-12', #Veterans Day
|
58
|
-
'2018-11-22', #Thanksgiving Day
|
59
|
-
'2018-12-25', #Christmas Day
|
60
|
-
|
61
|
-
'2019-01-01', #New Year’s Day
|
62
|
-
'2019-01-21', #Birthday of Martin Luther King, Jr.
|
63
|
-
'2019-02-18', #Washington’s Birthday
|
64
|
-
'2019-05-27', #Memorial Day
|
65
|
-
'2019-07-04', #Independence Day
|
66
|
-
'2019-09-02', #Labor Day
|
67
|
-
'2019-10-14', #Columbus Day
|
68
|
-
'2019-11-11', #Veterans Day
|
69
|
-
'2019-11-28', #Thanksgiving Day
|
70
|
-
'2019-12-25', #Christmas Day
|
71
|
-
|
72
|
-
'2020-01-01', #New Year’s Day
|
73
|
-
'2020-01-20', #Birthday of Martin Luther King, Jr.
|
74
|
-
'2020-02-17', #Washington’s Birthday
|
75
|
-
'2020-05-25', #Memorial Day
|
76
|
-
'2020-07-03', #Independence Day
|
77
|
-
'2020-09-07', #Labor Day
|
78
|
-
'2020-10-12', #Columbus Day
|
79
|
-
'2020-11-11', #Veterans Day
|
80
|
-
'2020-11-26', #Thanksgiving Day
|
81
|
-
'2020-12-25' #Christmas Day
|
82
|
-
].map {|date_str| Date.parse(date_str) }
|
83
|
-
}
|
84
4
|
|
85
5
|
let(:sample_weekends) { [Date.new(2014, 2, 1), Date.new(2014, 2, 2)] }
|
86
6
|
|
87
7
|
let(:sample_weekdays) { [3, 4, 5, 6, 7].map{|d| Date.new(2014, 2, d) } }
|
88
8
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
9
|
+
context "with saturday holiday date rolling" do
|
10
|
+
|
11
|
+
let(:sample_holidays) {
|
12
|
+
[
|
13
|
+
'2014-01-01', #New Year’s Day
|
14
|
+
'2014-01-20', #Birthday of Martin Luther King, Jr.
|
15
|
+
'2014-02-17', #Washington’s Birthday
|
16
|
+
'2014-05-26', #Memorial Day
|
17
|
+
'2014-07-04', #Independence Day
|
18
|
+
'2014-09-01', #Labor Day
|
19
|
+
'2014-10-13', #Columbus Day
|
20
|
+
'2014-11-11', #Veterans Day
|
21
|
+
'2014-11-27', #Thanksgiving Day
|
22
|
+
'2014-12-25', #Christmas Day
|
23
|
+
|
24
|
+
'2015-01-01', #New Year’s Day
|
25
|
+
'2015-01-19', #Birthday of Martin Luther King, Jr.
|
26
|
+
'2015-02-16', #Washington’s Birthday
|
27
|
+
'2015-05-25', #Memorial Day
|
28
|
+
'2015-07-03', #Independence Day
|
29
|
+
'2015-09-07', #Labor Day
|
30
|
+
'2015-10-12', #Columbus Day
|
31
|
+
'2015-11-11', #Veterans Day
|
32
|
+
'2015-11-26', #Thanksgiving Day
|
33
|
+
'2015-12-25', #Christmas Day
|
34
|
+
|
35
|
+
'2016-01-01', #New Year’s Day
|
36
|
+
'2016-01-18', #Birthday of Martin Luther King, Jr.
|
37
|
+
'2016-02-15', #Washington’s Birthday
|
38
|
+
'2016-05-30', #Memorial Day
|
39
|
+
'2016-07-04', #Independence Day
|
40
|
+
'2016-09-05', #Labor Day
|
41
|
+
'2016-10-10', #Columbus Day
|
42
|
+
'2016-11-11', #Veterans Day
|
43
|
+
'2016-11-24', #Thanksgiving Day
|
44
|
+
'2016-12-26', #Christmas Day
|
45
|
+
|
46
|
+
'2017-01-02', #New Year’s Day
|
47
|
+
'2017-01-16', #Birthday of Martin Luther King, Jr.
|
48
|
+
'2017-02-20', #Washington’s Birthday
|
49
|
+
'2017-05-29', #Memorial Day
|
50
|
+
'2017-07-04', #Independence Day
|
51
|
+
'2017-09-04', #Labor Day
|
52
|
+
'2017-10-09', #Columbus Day
|
53
|
+
'2017-11-10', #Veterans Day
|
54
|
+
'2017-11-23', #Thanksgiving Day
|
55
|
+
'2017-12-25', #Christmas Day
|
56
|
+
|
57
|
+
'2018-01-01', #New Year’s Day
|
58
|
+
'2018-01-15', #Birthday of Martin Luther King, Jr.
|
59
|
+
'2018-02-19', #Washington’s Birthday
|
60
|
+
'2018-05-28', #Memorial Day
|
61
|
+
'2018-07-04', #Independence Day
|
62
|
+
'2018-09-03', #Labor Day
|
63
|
+
'2018-10-08', #Columbus Day
|
64
|
+
'2018-11-12', #Veterans Day
|
65
|
+
'2018-11-22', #Thanksgiving Day
|
66
|
+
'2018-12-25', #Christmas Day
|
67
|
+
|
68
|
+
'2019-01-01', #New Year’s Day
|
69
|
+
'2019-01-21', #Birthday of Martin Luther King, Jr.
|
70
|
+
'2019-02-18', #Washington’s Birthday
|
71
|
+
'2019-05-27', #Memorial Day
|
72
|
+
'2019-07-04', #Independence Day
|
73
|
+
'2019-09-02', #Labor Day
|
74
|
+
'2019-10-14', #Columbus Day
|
75
|
+
'2019-11-11', #Veterans Day
|
76
|
+
'2019-11-28', #Thanksgiving Day
|
77
|
+
'2019-12-25', #Christmas Day
|
78
|
+
|
79
|
+
'2020-01-01', #New Year’s Day
|
80
|
+
'2020-01-20', #Birthday of Martin Luther King, Jr.
|
81
|
+
'2020-02-17', #Washington’s Birthday
|
82
|
+
'2020-05-25', #Memorial Day
|
83
|
+
'2020-07-03', #Independence Day
|
84
|
+
'2020-09-07', #Labor Day
|
85
|
+
'2020-10-12', #Columbus Day
|
86
|
+
'2020-11-11', #Veterans Day
|
87
|
+
'2020-11-26', #Thanksgiving Day
|
88
|
+
'2020-12-25', #Christmas Day
|
89
|
+
|
90
|
+
'2021-01-01',
|
91
|
+
'2021-01-18',
|
92
|
+
'2021-02-15',
|
93
|
+
'2021-05-31',
|
94
|
+
'2021-07-04',
|
95
|
+
'2021-09-06',
|
96
|
+
'2021-10-11',
|
97
|
+
'2021-11-11',
|
98
|
+
'2021-11-25',
|
99
|
+
'2021-12-25'
|
100
|
+
|
101
|
+
].map {|date_str| Date.parse(date_str) }
|
102
|
+
}
|
103
|
+
|
104
|
+
before :each do
|
105
|
+
allow(::UsBankHolidays).to receive(:saturday_holiday_date_rolling?).and_return(true)
|
106
106
|
end
|
107
107
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
108
|
+
describe '.bank_holiday?' do
|
109
|
+
it 'should determine bank holidays on the list' do
|
110
|
+
sample_holidays.each { |holiday|
|
111
|
+
UsBankHolidays.bank_holiday?(holiday).should eq(true)
|
112
|
+
UsBankHolidays.banking_day?(holiday).should eq(false)
|
113
|
+
}
|
114
|
+
end
|
113
115
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
end
|
116
|
+
it 'weekends should be bank holidays' do
|
117
|
+
sample_weekends.each { |weekend|
|
118
|
+
UsBankHolidays.bank_holiday?(weekend).should eq(true)
|
119
|
+
UsBankHolidays.banking_day?(weekend).should eq(false)
|
120
|
+
}
|
121
|
+
end
|
121
122
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
}
|
128
|
-
end
|
123
|
+
it 'should exclude weekends if the appropriate flag is passed' do
|
124
|
+
sample_weekends.each { |weekend|
|
125
|
+
UsBankHolidays.bank_holiday?(weekend, false).should eq(false)
|
126
|
+
}
|
127
|
+
end
|
129
128
|
|
130
|
-
|
131
|
-
|
129
|
+
it 'regular days should not be bank holidays' do
|
130
|
+
sample_weekdays.each { |day|
|
131
|
+
UsBankHolidays.bank_holiday?(day).should eq(false)
|
132
|
+
UsBankHolidays.banking_day?(day).should eq(true)
|
133
|
+
}
|
134
|
+
end
|
132
135
|
end
|
133
|
-
end
|
134
|
-
|
135
|
-
describe ::UsBankHolidays::DateMethods do
|
136
136
|
|
137
137
|
describe '.weekend?' do
|
138
|
-
|
139
138
|
it 'should recognize weekends' do
|
140
139
|
sample_weekends.each { |weekend|
|
141
|
-
weekend.
|
142
|
-
weekend.
|
140
|
+
UsBankHolidays.weekend?(weekend).should eq(true)
|
141
|
+
UsBankHolidays.banking_day?(weekend).should eq(false)
|
143
142
|
}
|
144
143
|
end
|
145
144
|
|
146
145
|
it 'weekdays should not be considered weekends' do
|
147
|
-
sample_weekdays.each { |day|
|
148
|
-
day.weekend?.should eq(false)
|
149
|
-
day.banking_day?.should eq(true)
|
150
|
-
}
|
146
|
+
sample_weekdays.each { |day| UsBankHolidays.weekend?(day).should eq(false) }
|
151
147
|
end
|
152
|
-
|
153
148
|
end
|
154
149
|
|
155
|
-
describe
|
150
|
+
describe ::UsBankHolidays::DateMethods do
|
156
151
|
|
157
|
-
|
158
|
-
sample_holidays.each { |holiday|
|
159
|
-
holiday.bank_holiday?.should eq(true)
|
160
|
-
holiday.banking_day?.should eq(false)
|
161
|
-
}
|
162
|
-
end
|
152
|
+
describe '.weekend?' do
|
163
153
|
|
164
|
-
|
165
|
-
|
166
|
-
|
154
|
+
it 'should recognize weekends' do
|
155
|
+
sample_weekends.each { |weekend|
|
156
|
+
weekend.weekend?.should eq(true)
|
157
|
+
weekend.banking_day?.should eq(false)
|
158
|
+
}
|
159
|
+
end
|
167
160
|
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
161
|
+
it 'weekdays should not be considered weekends' do
|
162
|
+
sample_weekdays.each { |day|
|
163
|
+
day.weekend?.should eq(false)
|
164
|
+
day.banking_day?.should eq(true)
|
165
|
+
}
|
166
|
+
end
|
174
167
|
|
175
|
-
it 'should not treat regular weekdays as bank holidays' do
|
176
|
-
sample_weekdays.each { |day|
|
177
|
-
day.bank_holiday?.should eq(false)
|
178
|
-
day.banking_day?.should eq(true)
|
179
|
-
}
|
180
168
|
end
|
181
169
|
|
182
|
-
|
183
|
-
|
170
|
+
describe '.bank_holiday?' do
|
171
|
+
|
172
|
+
it 'should recognize bank holidays' do
|
173
|
+
sample_holidays.each { |holiday|
|
174
|
+
holiday.bank_holiday?.should eq(true)
|
175
|
+
holiday.banking_day?.should eq(false)
|
176
|
+
}
|
177
|
+
end
|
178
|
+
|
179
|
+
it 'should treat weekends as bank holidays' do
|
180
|
+
sample_weekends.each { |weekend| weekend.bank_holiday?.should eq(true) }
|
181
|
+
end
|
182
|
+
|
183
|
+
it 'should exclude weekends if the appropriate flag is passed' do
|
184
|
+
sample_weekends.each { |weekend|
|
185
|
+
weekend.weekend?.should eq(true)
|
186
|
+
weekend.bank_holiday?(false).should eq(false)
|
187
|
+
}
|
188
|
+
end
|
189
|
+
|
190
|
+
it 'should not treat regular weekdays as bank holidays' do
|
191
|
+
sample_weekdays.each { |day|
|
192
|
+
day.bank_holiday?.should eq(false)
|
193
|
+
day.banking_day?.should eq(true)
|
194
|
+
}
|
195
|
+
end
|
196
|
+
|
197
|
+
it 'if Jan. 1 falls on a Saturday, Dec. 31 of the previous year should be a bank holiday' do
|
198
|
+
Date.new(2021, 12, 31).bank_holiday?.should eq(true)
|
199
|
+
end
|
184
200
|
end
|
185
|
-
end
|
186
201
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
202
|
+
describe '.next_banking_day' do
|
203
|
+
it 'should determine the next banking day' do
|
204
|
+
Date.new(2014, 1, 1).next_banking_day.should == Date.new(2014, 1, 2)
|
205
|
+
Date.new(2014, 1, 2).next_banking_day.should == Date.new(2014, 1, 3)
|
206
|
+
Date.new(2014, 1, 3).next_banking_day.should == Date.new(2014, 1, 6)
|
207
|
+
Date.new(2014, 1, 4).next_banking_day.should == Date.new(2014, 1, 6)
|
208
|
+
Date.new(2014, 1, 5).next_banking_day.should == Date.new(2014, 1, 6)
|
209
|
+
end
|
194
210
|
end
|
195
|
-
end
|
196
211
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
212
|
+
describe '.previous_baking_day' do
|
213
|
+
it 'should determine the previous banking day' do
|
214
|
+
Date.new(2014, 1, 7).previous_banking_day.should == Date.new(2014, 1, 6)
|
215
|
+
Date.new(2014, 1, 6).previous_banking_day.should == Date.new(2014, 1, 3)
|
216
|
+
Date.new(2014, 1, 5).previous_banking_day.should == Date.new(2014, 1, 3)
|
217
|
+
Date.new(2014, 1, 4).previous_banking_day.should == Date.new(2014, 1, 3)
|
218
|
+
Date.new(2014, 1, 21).previous_banking_day.should == Date.new(2014, 1, 17)
|
219
|
+
end
|
204
220
|
end
|
205
|
-
end
|
206
221
|
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
222
|
+
describe '.add_banking_days' do
|
223
|
+
it 'should return self if given 0' do
|
224
|
+
Date.new(2014, 1, 7).add_banking_days(0).should == Date.new(2014, 1, 7)
|
225
|
+
end
|
211
226
|
|
212
|
-
|
213
|
-
|
214
|
-
|
227
|
+
it 'should return self if given 0 even if self is a bank holiday' do
|
228
|
+
Date.new(2014, 1, 4).add_banking_days(0).should == Date.new(2014, 1, 4)
|
229
|
+
end
|
230
|
+
|
231
|
+
it 'if given a positive number, should add banking days, ignoring bank holidays' do
|
232
|
+
Date.new(2014, 1, 16).add_banking_days(2).should == Date.new(2014, 1, 21)
|
233
|
+
end
|
215
234
|
|
216
|
-
|
217
|
-
|
235
|
+
it 'if given a negative number, should subtract banking days, ignoring bank holidays' do
|
236
|
+
Date.new(2014, 1, 21).add_banking_days(-2).should == Date.new(2014, 1, 16)
|
237
|
+
end
|
218
238
|
end
|
219
239
|
|
220
|
-
|
221
|
-
|
240
|
+
describe '.last_banking_day_of_month?' do
|
241
|
+
it 'should determine if a date is the last banking day of the month' do
|
242
|
+
Date.new(2014, 1, 31).last_banking_day_of_month?.should eq(true)
|
243
|
+
Date.new(2014, 1, 30).last_banking_day_of_month?.should eq(false)
|
244
|
+
|
245
|
+
Date.new(2014, 11, 30).last_banking_day_of_month?.should eq(false)
|
246
|
+
Date.new(2014, 11, 28).last_banking_day_of_month?.should eq(true)
|
247
|
+
end
|
222
248
|
end
|
223
|
-
end
|
224
249
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
250
|
+
describe '.first_banking_day_of_month?' do
|
251
|
+
it 'should determine if the date if the first banking day of the month' do
|
252
|
+
Date.new(2014, 4, 1).first_banking_day_of_month?.should eq(true)
|
253
|
+
Date.new(2014, 4, 2).first_banking_day_of_month?.should eq(false)
|
229
254
|
|
230
|
-
|
231
|
-
|
255
|
+
Date.new(2014, 6, 1).first_banking_day_of_month?.should eq(false)
|
256
|
+
Date.new(2014, 6, 2).first_banking_day_of_month?.should eq(true)
|
257
|
+
end
|
232
258
|
end
|
233
259
|
end
|
260
|
+
end
|
234
261
|
|
235
|
-
|
236
|
-
it 'should determine if the date if the first banking day of the month' do
|
237
|
-
Date.new(2014, 4, 1).first_banking_day_of_month?.should eq(true)
|
238
|
-
Date.new(2014, 4, 2).first_banking_day_of_month?.should eq(false)
|
262
|
+
context "no saturday holiday date rolling" do
|
239
263
|
|
240
|
-
|
241
|
-
|
242
|
-
|
264
|
+
before :each do
|
265
|
+
allow(::UsBankHolidays).to receive(:saturday_holiday_date_rolling?).and_return(false)
|
266
|
+
end
|
267
|
+
|
268
|
+
let(:banking_days) {
|
269
|
+
[
|
270
|
+
'2021-06-18',
|
271
|
+
'2021-12-31'
|
272
|
+
].map {|date_str| Date.parse(date_str) }
|
273
|
+
}
|
274
|
+
|
275
|
+
specify 'banking days' do
|
276
|
+
banking_days.each { |date|
|
277
|
+
UsBankHolidays.bank_holiday?(date).should eq(false)
|
278
|
+
UsBankHolidays.banking_day?(date).should eq(true)
|
279
|
+
}
|
243
280
|
end
|
244
281
|
end
|
245
282
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: us_bank_holidays
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arthur Shagall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|