spec/job_cron_spec.rb in rufus-scheduler-3.0.7 vs spec/job_cron_spec.rb in rufus-scheduler-3.0.8

- old
+ new

@@ -23,11 +23,11 @@ job = @scheduler.schedule_cron '* * * * *' do; end sleep_until_next_minute - (job.last_time.to_i % 10).should == 0 + expect(job.last_time.to_i % 10).to eq(0) end end #context 'sub-minute' do # @@ -57,12 +57,12 @@ #p [ t, t.to_f ] #p [ job.last_time, job.last_time.to_f ] #p [ job.first_at, job.first_at.to_f ] - job.first_at.should be_within_1s_of(t + 3) - job.last_time.should == nil + expect(job.first_at).to be_within_1s_of(t + 3) + expect(job.last_time).to eq(nil) end it 'triggers for the first time at first_at' do first_time = nil @@ -71,12 +71,12 @@ job = @scheduler.schedule_cron '* * * * * *', :first_in => '3s' do first_time ||= Time.now end sleep 4.5 - job.first_at.should be_within_1s_of(t + 3) - first_time.should be_within_1s_of(job.first_at) + expect(job.first_at).to be_within_1s_of(t + 3) + expect(first_time).to be_within_1s_of(job.first_at) end end context 'scheduling the cron itself' do @@ -91,14 +91,14 @@ job = @scheduler.schedule_cron '*/2 * * * * *' do first ||= Time.now end - (Time.now - n).should < 1.0 + expect(Time.now - n).to be < 1.0 loop do next unless first - (first - n).should < 4.0 + expect(first - n).to be < 4.0 break end end end end