spec/cronline_spec.rb in rufus-scheduler-3.1.4 vs spec/cronline_spec.rb in rufus-scheduler-3.1.5
- old
+ new
@@ -98,16 +98,16 @@
to_a '13 */17 * * * *', [[13], [0, 17, 34, 51], nil, nil, nil, nil, nil, nil]
end
it 'rejects invalid weekday expressions' do
- expect { cl '0 17 * * MON_FRI' }.to raise_error
+ expect { cl '0 17 * * MON_FRI' }.to raise_error(ArgumentError)
# underline instead of dash
- expect { cl '* * * * 9' }.to raise_error
- expect { cl '* * * * 0-12' }.to raise_error
- expect { cl '* * * * BLABLA' }.to raise_error
+ expect { cl '* * * * 9' }.to raise_error(ArgumentError)
+ expect { cl '* * * * 0-12' }.to raise_error(ArgumentError)
+ expect { cl '* * * * BLABLA' }.to raise_error(ArgumentError)
end
it 'rejects invalid cronlines' do
expect { cl '* nada * * 9' }.to raise_error(ArgumentError)
@@ -123,12 +123,12 @@
[ nil, nil, nil, nil, nil, nil, nil, 'America/Chicago' ])
to_a(
'* * * * * * America/New_York',
[ nil, nil, nil, nil, nil, nil, nil, 'America/New_York' ])
- expect { cl '* * * * * NotATimeZone' }.to raise_error
- expect { cl '* * * * * * NotATimeZone' }.to raise_error
+ expect { cl '* * * * * NotATimeZone' }.to raise_error(ArgumentError)
+ expect { cl '* * * * * * NotATimeZone' }.to raise_error(ArgumentError)
end
it 'interprets cron strings with / (slashes) correctly' do
to_a(
@@ -430,11 +430,11 @@
)
expect(nt('*/10 * * * * *',local(1970,1,1,1,1,49))).to(
eq(local(1970,1,1,1,1,50))
)
expect(nt('*/10 * * * * *',local(1970,1,1,1,1,50))).to(
- eq(local(1970,1,1,1,2,00)) # FAILS: skips a minute to 2:50, not 2:00
+ eq(local(1970,1,1,1,2,00))
)
end
end
describe '#next_second' do
@@ -448,12 +448,12 @@
[ '*/10 * * * * *', local(1970,1,1,1,1,20), 0 ], # 0 sec to 20s mark
[ '*/10 * * * * *', local(1970,1,1,1,1,21), 9 ], # 1 sec to 30s mark
# ...
[ '*/10 * * * * *', local(1970,1,1,1,1,49), 1 ], # 9 sec to 50s mark
[ '*/10 * * * * *', local(1970,1,1,1,1,50), 0 ], # 0 sec to 50s mark
- [ '*/10 * * * * *', local(1970,1,1,1,1,51), 9 ], # FAILS: gives 59
- ].each do |cronline,now,sec|
- it "understands that next_second('#{cronline}',#{now}) is #{sec}" do
+ [ '*/10 * * * * *', local(1970,1,1,1,1,51), 9 ],
+ ].each do |cronline, now, sec|
+ it "ensures that next_second('#{cronline}', #{now}) is #{sec}" do
expect(ns(cronline,now)).to eq(sec)
end
end
end