spec/job_repeat_spec.rb in rufus-scheduler-3.0.4 vs spec/job_repeat_spec.rb in rufus-scheduler-3.0.5

- old
+ new

@@ -172,9 +172,32 @@ @scheduler.schedule_every '0.5s', :first => Time.now - 60 do; end }.should raise_error(ArgumentError) end + + context ':first_time => :now/:immediately' do + + it 'schedules the first execution immediately' do + + n = Time.now + ft = nil + + job = + @scheduler.schedule_every '7s', :first => :now do + ft ||= Time.now + end + + sleep 0.5 + + #p n.to_f + #p job.first_at.to_f + #p ft.to_f + + job.first_at.should < n + 0.5 + ft.should < job.first_at + @scheduler.frequency + 0.1 + end + end end describe ':first/:first_in/:first_at => duration' do it 'accepts a duration string' do