|
254 | 254 | schedule.rrules.should == rules
|
255 | 255 | end
|
256 | 256 |
|
| 257 | + it 'can retrieve exrules from a schedule' do |
| 258 | + schedule = IceCube::Schedule.new(Time.now) |
| 259 | + rules = [IceCube::Rule.daily, IceCube::Rule.monthly, IceCube::Rule.yearly] |
| 260 | + rules.each { |r| schedule.add_exception_rule(r) } |
| 261 | + # pull the rules back out of the schedule and compare |
| 262 | + schedule.exrules.should == rules |
| 263 | + end |
| 264 | + |
257 | 265 | it 'can retrieve recurrence times from a schedule' do
|
258 | 266 | schedule = IceCube::Schedule.new(Time.now)
|
259 | 267 | times = [Time.now, Time.now + 5, Time.now + 10]
|
|
569 | 577 | schedule.rrules.should == [daily, monthly]
|
570 | 578 | end
|
571 | 579 |
|
| 580 | + it 'should have some convenient alias for exrules' do |
| 581 | + schedule = IceCube::Schedule.new(Time.now) |
| 582 | + daily = IceCube::Rule.daily; monthly = IceCube::Rule.monthly |
| 583 | + schedule.add_exception_rule daily |
| 584 | + schedule.exrule monthly |
| 585 | + schedule.exrules.should == [daily, monthly] |
| 586 | + end |
| 587 | + |
572 | 588 | it 'should have some convenient alias for recurrence_times' do
|
573 | 589 | schedule = IceCube::Schedule.new(Time.now)
|
574 | 590 | schedule.add_recurrence_time Time.local(2010, 8, 13)
|
|
583 | 599 | schedule.extimes.should == [Time.local(2010, 8, 13), Time.local(2010, 8, 14)]
|
584 | 600 | end
|
585 | 601 |
|
| 602 | + it 'should be able to have a rule and an exrule' do |
| 603 | + schedule = IceCube::Schedule.new(Time.local(2010, 8, 27, 10)) |
| 604 | + schedule.rrule IceCube::Rule.daily |
| 605 | + schedule.exrule IceCube::Rule.daily.day(:friday) |
| 606 | + schedule.occurs_on?(Date.new(2010, 8, 27)).should be_false |
| 607 | + schedule.occurs_on?(Date.new(2010, 8, 28)).should be_true |
| 608 | + end |
| 609 | + |
586 | 610 | it 'should always generate the correct number of days for .first' do
|
587 | 611 | s = IceCube::Schedule.new(Time.zone.parse('1-1-1985'))
|
588 | 612 | r = IceCube::Rule.weekly(3).day(:monday, :wednesday, :friday)
|
|
0 commit comments