spec/timeout_spec.rb in rufus-scheduler-2.0.6 vs spec/timeout_spec.rb in rufus-scheduler-2.0.7

- old
+ new

@@ -3,46 +3,46 @@ # Specifying rufus-scheduler # # Sun May 3 15:44:28 JST 2009 # -require File.dirname(__FILE__) + '/spec_base' +require File.join(File.dirname(__FILE__), '/spec_base') describe "#{SCHEDULER_CLASS} timeouts" do - before do + before(:each) do @s = start_scheduler end - after do + after(:each) do stop_scheduler(@s) end - it 'should should refuse to schedule a job with :timeout and :blocking' do + it 'refuses to schedule a job with :timeout and :blocking' do lambda { @s.in '1s', :timeout => '3s', :blocking => true do end - }.should.raise(ArgumentError) + }.should raise_error(ArgumentError) end - it 'should schedule a dedicated job for the timeout' do + it 'schedules a dedicated job for the timeout' do @s.in '1s', :timeout => '3s' do sleep 5 end - @s.jobs.size.should.equal(1) + @s.jobs.size.should == 1 # the timeout job is left sleep 2 - @s.jobs.size.should.equal(1) - @s.find_by_tag('timeout').size.should.equal(1) + @s.jobs.size.should == 1 + @s.find_by_tag('timeout').size.should == 1 end - it 'should time out' do + it 'times out' do var = nil timedout = false @s.in '1s', :timeout => '1s' do @@ -54,16 +54,16 @@ end end sleep 4 - var.should.be.nil - @s.jobs.size.should.equal(0) - timedout.should.be.true + var.should == nil + @s.jobs.size.should == 0 + timedout.should == true end - it 'should die silently if job finished before timeout' do + it 'dies silently if job finished before timeout' do var = nil timedout = false @s.in '1s', :timeout => '1s' do @@ -74,16 +74,16 @@ end end sleep 3 - var.should.be.true - @s.jobs.size.should.equal(0) - timedout.should.be.false + var.should == true + @s.jobs.size.should == 0 + timedout.should == false end - it 'should not timeout other jobs (in case of every)' do + it 'does not timeout other jobs (in case of every)' do timeouts = [] @s.every '1s', :timeout => '1s500' do start = Time.now @@ -94,32 +94,32 @@ end end sleep 5 - timeouts.size.should.equal(3) - timeouts.each { |to| (to * 10).to_i.should.equal(16) } + timeouts.size.should == 3 + timeouts.each { |to| (to * 10).to_i.should == 16 } end - it 'should point to their "parent" job' do + it 'points to their "parent" job' do @s.in '1s', :timeout => '3s', :job_id => 'nada' do sleep 4 end sleep 2 - @s.jobs.values.first.parent.job_id.should.equal('nada') + @s.jobs.values.first.parent.job_id.should == 'nada' end - it 'should not survive their job' do + it 'does not survive their job' do @s.in '1s', :timeout => '3s' do sleep 0.100 end sleep 2 - @s.jobs.size.should.equal(0) + @s.jobs.size.should == 0 end end