Sha256: 5f49c9a9187f666a823e7daf70de1005f00e71eed834b7ddbad349cf844fa1bc
Contents?: true
Size: 1.23 KB
Versions: 8
Compression:
Stored size: 1.23 KB
Contents
# # Specifying rufus-scheduler # # Sat Jul 13 04:52:08 JST 2013 # # In the train between Bern and Fribourg, riding back # from the @ruvetia drinkup # require 'spec_helper' describe Rufus::Scheduler do before :each do @scheduler = Rufus::Scheduler.new end after :each do @scheduler.shutdown end describe '#cron' do it 'schedules' do counter = 0 sleep_until_next_second sleep 0.3 # make sure to schedule right after a scheduler 'tick' job = @scheduler.cron '* * * * * *', :job => true do counter = counter + 1 end sleep_until_next_second sleep_until_next_second sleep 0.3 # be sure to be well into the second counter.should == 2 end it 'raises if the job frequency is higher than the scheduler frequency' do @scheduler.frequency = 10 lambda { @scheduler.cron '* * * * * *' do; end }.should raise_error(ArgumentError) end end describe '#schedule_cron' do it 'returns a CronJob instance' do job = @scheduler.schedule_cron '* * * * *' do; end job.class.should == Rufus::Scheduler::CronJob job.original.should == '* * * * *' job.job_id.should match(/^cron_/) end end end
Version data entries
8 entries across 8 versions & 1 rubygems