|
84 | 84 | describe "#set_working_days" do |
85 | 85 | subject(:set_working_days) { calendar.set_working_days(working_days) } |
86 | 86 |
|
87 | | - let(:calendar) { described_class.new({}) } |
| 87 | + let(:calendar) { described_class.new(name: "test") } |
88 | 88 | let(:working_days) { [] } |
89 | 89 |
|
90 | 90 | context "when given valid working days" do |
|
123 | 123 | describe "#set_holidays" do |
124 | 124 | subject(:holidays) { calendar.holidays } |
125 | 125 |
|
126 | | - let(:calendar) { described_class.new({}) } |
| 126 | + let(:calendar) { described_class.new(name: "test") } |
127 | 127 | let(:holiday_dates) { [] } |
128 | 128 |
|
129 | 129 | before { calendar.set_holidays(holiday_dates) } |
|
148 | 148 | describe "#set_extra_working_dates" do |
149 | 149 | subject(:extra_working_dates) { calendar.extra_working_dates } |
150 | 150 |
|
151 | | - let(:calendar) { described_class.new({}) } |
| 151 | + let(:calendar) { described_class.new(name: "test") } |
152 | 152 | let(:extra_dates) { [] } |
153 | 153 |
|
154 | 154 | before { calendar.set_extra_working_dates(extra_dates) } |
|
172 | 172 |
|
173 | 173 | context "when holiday is also a working date" do |
174 | 174 | let(:instance) do |
175 | | - described_class.new(holidays: ["2018-01-06"], |
| 175 | + described_class.new(name: "test", |
| 176 | + holidays: ["2018-01-06"], |
176 | 177 | extra_working_dates: ["2018-01-06"]) |
177 | 178 | end |
178 | 179 |
|
|
184 | 185 |
|
185 | 186 | context "when working date on working day" do |
186 | 187 | let(:instance) do |
187 | | - described_class.new(working_days: ["mon"], |
| 188 | + described_class.new(name: "test", |
| 189 | + working_days: ["mon"], |
188 | 190 | extra_working_dates: ["Monday 26th Mar, 2018"]) |
189 | 191 | end |
190 | 192 |
|
|
202 | 204 | subject { calendar.business_day?(day) } |
203 | 205 |
|
204 | 206 | let(:calendar) do |
205 | | - described_class.new(holidays: ["9am, Tuesday 1st Jan, 2013"], |
| 207 | + described_class.new(name: "test", |
| 208 | + holidays: ["9am, Tuesday 1st Jan, 2013"], |
206 | 209 | extra_working_dates: ["9am, Sunday 6th Jan, 2013"]) |
207 | 210 | end |
208 | 211 |
|
|
235 | 238 | subject { calendar.working_day?(day) } |
236 | 239 |
|
237 | 240 | let(:calendar) do |
238 | | - described_class.new(holidays: ["9am, Tuesday 1st Jan, 2013"], |
| 241 | + described_class.new(name: "test", |
| 242 | + holidays: ["9am, Tuesday 1st Jan, 2013"], |
239 | 243 | extra_working_dates: ["9am, Sunday 6th Jan, 2013"]) |
240 | 244 | end |
241 | 245 |
|
|
268 | 272 | subject { calendar.holiday?(day) } |
269 | 273 |
|
270 | 274 | let(:calendar) do |
271 | | - described_class.new(holidays: ["9am, Tuesday 1st Jan, 2013"], |
| 275 | + described_class.new(name: "test", |
| 276 | + holidays: ["9am, Tuesday 1st Jan, 2013"], |
272 | 277 | extra_working_dates: ["9am, Sunday 6th Jan, 2013"]) |
273 | 278 | end |
274 | 279 |
|
|
301 | 306 | subject { calendar.roll_forward(date) } |
302 | 307 |
|
303 | 308 | let(:calendar) do |
304 | | - described_class.new(holidays: ["Tuesday 1st Jan, 2013"]) |
| 309 | + described_class.new(name: "test", holidays: ["Tuesday 1st Jan, 2013"]) |
305 | 310 | end |
306 | 311 |
|
307 | 312 | context "given a business day" do |
|
329 | 334 | subject { calendar.roll_backward(date) } |
330 | 335 |
|
331 | 336 | let(:calendar) do |
332 | | - described_class.new(holidays: ["Tuesday 1st Jan, 2013"]) |
| 337 | + described_class.new(name: "test", holidays: ["Tuesday 1st Jan, 2013"]) |
333 | 338 | end |
334 | 339 |
|
335 | 340 | context "given a business day" do |
|
357 | 362 | subject { calendar.next_business_day(date) } |
358 | 363 |
|
359 | 364 | let(:calendar) do |
360 | | - described_class.new(holidays: ["Tuesday 1st Jan, 2013"]) |
| 365 | + described_class.new(name: "test", holidays: ["Tuesday 1st Jan, 2013"]) |
361 | 366 | end |
362 | 367 |
|
363 | 368 | context "given a business day" do |
|
385 | 390 | subject { calendar.previous_business_day(date) } |
386 | 391 |
|
387 | 392 | let(:calendar) do |
388 | | - described_class.new(holidays: ["Tuesday 1st Jan, 2013"]) |
| 393 | + described_class.new(name: "test", holidays: ["Tuesday 1st Jan, 2013"]) |
389 | 394 | end |
390 | 395 |
|
391 | 396 | context "given a business day" do |
|
414 | 419 |
|
415 | 420 | let(:extra_working_dates) { [] } |
416 | 421 | let(:calendar) do |
417 | | - described_class.new(holidays: ["Tuesday 1st Jan, 2013"], |
| 422 | + described_class.new(name: "test", |
| 423 | + holidays: ["Tuesday 1st Jan, 2013"], |
418 | 424 | extra_working_dates: extra_working_dates) |
419 | 425 | end |
420 | 426 | let(:delta) { 2 } |
|
458 | 464 |
|
459 | 465 | let(:extra_working_dates) { [] } |
460 | 466 | let(:calendar) do |
461 | | - described_class.new(holidays: ["Thursday 3rd Jan, 2013"], |
| 467 | + described_class.new(name: "test", |
| 468 | + holidays: ["Thursday 3rd Jan, 2013"], |
462 | 469 | extra_working_dates: extra_working_dates) |
463 | 470 | end |
464 | 471 | let(:delta) { 2 } |
|
511 | 518 | ["Sun 1/6/2014", "Sat 28/6/2014", "Sat 5/7/2014"] |
512 | 519 | end |
513 | 520 | let(:calendar) do |
514 | | - described_class.new(holidays: holidays, extra_working_dates: extra_working_dates) |
| 521 | + described_class.new(name: "test", |
| 522 | + holidays: holidays, |
| 523 | + extra_working_dates: extra_working_dates) |
515 | 524 | end |
516 | 525 |
|
517 | 526 | context "starting on a business day" do |
|
0 commit comments