Add specs for bug with jobs scheduled at same time without at

This commit is contained in:
Dzmitry Plashchynski
2015-04-13 14:19:34 +03:00
parent e8c7400caa
commit a28ec7b276

View File

@@ -23,7 +23,7 @@ describe Crono::Scheduler do
expect(jobs).to be_eql [jobs[0]]
end
it 'should return an array of jobs scheduled at same time' do
it 'should return an array of jobs scheduled at same time with `at`' do
time = 5.minutes.from_now
scheduler.jobs = jobs = [
Crono::Period.new(1.day, at: time.strftime('%H:%M')),
@@ -34,5 +34,17 @@ describe Crono::Scheduler do
time, jobs = scheduler.next_jobs
expect(jobs).to be_eql [jobs[0], jobs[1]]
end
it 'should return an array of jobs scheduled at same time without `at`' do
time = 5.minutes.from_now
scheduler.jobs = jobs = [
Crono::Period.new(10.seconds),
Crono::Period.new(10.seconds),
Crono::Period.new(1.day, at: 10.minutes.from_now.strftime('%H:%M'))
].map { |period| Crono::Job.new(TestJob, period) }
time, jobs = scheduler.next_jobs
expect(jobs).to be_eql [jobs[0], jobs[1]]
end
end
end