spec/blocking_spec.rb in rufus-scheduler-2.0.17 vs spec/blocking_spec.rb in rufus-scheduler-2.0.18
- old
+ new
@@ -15,32 +15,36 @@
end
after(:each) do
stop_scheduler(@s)
end
- JOB = Proc.new do |x|
- begin
- $var << "a#{x}"
- sleep 0.500
- $var << "b#{x}"
- rescue Exception => e
- puts '=' * 80
- p e
- puts '=' * 80
+ JOB =
+ Proc.new do |x|
+ begin
+ $var << "a#{x}"
+ sleep 0.500
+ $var << "b#{x}"
+ rescue Exception => e
+ puts '=' * 80
+ p e
+ puts '=' * 80
+ end
end
- end
context ':blocking => nil' do
it "doesn't block" do
$var = []
@s.in('1s') { JOB.call(1) }
@s.in('1s') { JOB.call(2) }
- sleep 5.0
+ sleep 4.0
- [ %w{ a1 a2 b1 b2 }, %w{ a1 a2 b2 b1 } ].should include($var)
+ [
+ %w{ a1 a2 b1 b2 }, %w{ a1 a2 b2 b1 },
+ %w{ a2 a1 b2 b1 }, %w{ a2 a1 b1 b2 }
+ ].should include($var)
end
end
context ':blocking => true' do