spec/blocking_spec.rb in rufus-scheduler-2.0.11 vs spec/blocking_spec.rb in rufus-scheduler-2.0.12
- old
+ new
@@ -3,11 +3,11 @@
# Specifying rufus-scheduler
#
# Sat Mar 21 17:36:36 JST 2009
#
-require File.join(File.dirname(__FILE__), 'spec_base')
+require 'spec_base'
describe SCHEDULER_CLASS do
before(:each) do
@@ -27,28 +27,34 @@
p e
puts '=' * 80
end
end
- it "doesn't block when :blocking => nil" do
+ context ':blocking => nil' do
- $var = []
- @s.in('1s') { JOB.call(1) }
- @s.in('1s') { JOB.call(2) }
+ it "doesn't block" do
- sleep 5.0
+ $var = []
+ @s.in('1s') { JOB.call(1) }
+ @s.in('1s') { JOB.call(2) }
- [ %w{ a1 a2 b1 b2 }, %w{ a1 a2 b2 b1 } ].should include($var)
+ sleep 5.0
+
+ [ %w{ a1 a2 b1 b2 }, %w{ a1 a2 b2 b1 } ].should include($var)
+ end
end
- it 'blocks when :blocking => true' do
+ context ':blocking => true' do
- $var = []
- @s.in('1s', :blocking => true) { JOB.call(8) }
- @s.in('1s', :blocking => true) { JOB.call(9) }
+ it 'blocks' do
- sleep 4.5
+ $var = []
+ @s.in('1s', :blocking => true) { JOB.call(8) }
+ @s.in('1s', :blocking => true) { JOB.call(9) }
- $var.should == %w[ a8 b8 a9 b9 ]
+ sleep 4.5
+
+ $var.should == %w[ a8 b8 a9 b9 ]
+ end
end
end