Handle a few jobs scheduled at the same time

This commit is contained in:
Dzmitry Plashchynski
2015-04-08 20:08:58 +03:00
parent d075a55f03
commit b4ad8fb953
5 changed files with 38 additions and 27 deletions

View File

@@ -1,7 +1,7 @@
require 'spec_helper'
describe Crono::Job do
let(:period) { Crono::Period.new(2.day) }
let(:period) { Crono::Period.new(2.day, at: '15:00') }
let(:job) { Crono::Job.new(TestJob, period) }
let(:failing_job) { Crono::Job.new(TestFailingJob, period) }
@@ -10,6 +10,12 @@ describe Crono::Job do
expect(job.period).to be period
end
describe '#next' do
it 'should return next performing time according to period' do
expect(job.next).to be_eql period.next
end
end
describe '#perform' do
after { job.send(:model).destroy }
@@ -47,7 +53,7 @@ describe Crono::Job do
describe '#description' do
it 'should return job identificator' do
expect(job.description).to be_eql('Perform TestJob every 2 days')
expect(job.description).to be_eql('Perform TestJob every 2 days at 15:00')
end
end