add data to Cron.perform which will be passed to ExampleJob.new(data).perform

This commit is contained in:
Jannis Hübl
2016-01-13 17:44:27 +01:00
parent 6881109934
commit dd4f92b569
6 changed files with 46 additions and 15 deletions

View File

@@ -18,4 +18,10 @@ describe Crono::PerformerProxy do
expect_any_instance_of(described_class).to receive(:once_per)
Crono.perform(TestJob).once_per 10.minutes
end
it 'should add job with data to schedule' do
expect(Crono::Job).to receive(:new).with(TestJob, kind_of(Crono::Period), {some: 'data'})
allow(Crono.scheduler).to receive(:add_job)
Crono.perform(TestJob, {some: 'data'}).every(2.days, at: '15:30')
end
end