Sha256: 571c5aa0f0a8ec4c18fc5a9339a382c5dad5f82396a25ad7b0b8a473eeff3bfe
Contents?: true
Size: 1.7 KB
Versions: 2
Compression:
Stored size: 1.7 KB
Contents
require 'spec_helper' class TestJob def perform puts 'Test!' end end describe Crono::PerformerProxy do it 'should add job to schedule' do expect(Crono.scheduler).to receive(:add_job).with(kind_of(Crono::Job)) Crono.perform(TestJob).every(2.days, at: '15:30') end it 'should set execution interval' do allow(Crono).to receive(:scheduler).and_return(Crono::Scheduler.new) expect_any_instance_of(Crono::Job).to receive(:execution_interval=).with(0.minutes).once expect_any_instance_of(Crono::Job).to receive(:execution_interval=).with(10.minutes).once Crono.perform(TestJob).every(2.days, at: '15:30').once_per 10.minutes end it 'do nothing when job not initalized' do expect_any_instance_of(Crono::Job).not_to receive(:execution_interval=) expect_any_instance_of(described_class).to receive(:once_per) Crono.perform(TestJob).once_per 10.minutes end it 'should add job with args to schedule' do expect(Crono::Job).to receive(:new).with(TestJob, kind_of(Crono::Period), :some, { some: 'data' }) allow(Crono.scheduler).to receive(:add_job) Crono.perform(TestJob, :some, { some: 'data' }).every(2.days, at: '15:30') end it 'should add job without args to schedule' do expect(Crono::Job).to receive(:new).with(TestJob, kind_of(Crono::Period), nil, nil) allow(Crono.scheduler).to receive(:add_job) Crono.perform(TestJob).every(2.days, at: '15:30') end it 'should add job with options to schedule' do expect(Crono::Job).to receive(:new).with(TestJob, kind_of(Crono::Period), nil, { some_option: true }) allow(Crono.scheduler).to receive(:add_job) Crono.perform(TestJob).with_options(some_option: true).every(2.days, at: '15:30') end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
crono-2.1.0 | spec/performer_proxy_spec.rb |
crono-2.0.1 | spec/performer_proxy_spec.rb |