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

- old
+ new

@@ -22,12 +22,12 @@ it 'adds a job' do @scheduler.interval(10) do end - @scheduler.jobs.size.should == 1 - @scheduler.jobs.first.class.should == Rufus::Scheduler::IntervalJob + expect(@scheduler.jobs.size).to eq(1) + expect(@scheduler.jobs.first.class).to eq(Rufus::Scheduler::IntervalJob) end it 'triggers a job (2 times)' do counter = 0 @@ -36,11 +36,11 @@ counter += 1 end sleep 2.0 - counter.should > 2 + expect(counter).to be > 2 end it 'triggers, but reschedules after the trigger execution' do chronos = [] @@ -53,19 +53,19 @@ end t = Time.now sleep 0.1 while chronos.size < 4 && Time.now < t + 5 - chronos.size.should == 4 + expect(chronos.size).to eq(4) deltas = chronos.collect(&:last).compact #pp chronos #pp deltas deltas.each do |d| - d.should >= 0.9 + expect(d).to be >= 0.9 end end it 'does not reschedule if the job was unscheduled' do @@ -76,35 +76,35 @@ counter = counter + 1 end sleep 1.6 - @scheduler.jobs(:all).size.should == 1 + expect(@scheduler.jobs(:all).size).to eq(1) job.unschedule c = counter sleep 1.6 - counter.should == c - @scheduler.jobs(:all).size.should == 0 + expect(counter).to eq(c) + expect(@scheduler.jobs(:all).size).to eq(0) end it 'raises on negative intervals' do - lambda { + expect { @scheduler.interval(-1) do end - }.should raise_error(ArgumentError) + }.to raise_error(ArgumentError) end it 'raises on zero intervals' do - lambda { + expect { @scheduler.interval(0) do end - }.should raise_error(ArgumentError) + }.to raise_error(ArgumentError) end #it 'raises if the job frequency is higher than the scheduler frequency' do # # @scheduler.frequency = 10 @@ -119,10 +119,10 @@ it 'accepts a duration string' do job = @scheduler.schedule_interval('1h') do; end - job.interval.should == 3600 + expect(job.interval).to eq(3600) end end end