Revision
3464
Author
ernest.prabhakar@gmail.com
Date
2010-02-09 15:23:38 -0800 (Tue, 09 Feb 2010)

Log Message

Spec to ensure Enumerable#p_each is happening concurrently

Modified Paths

Diff

Modified: MacRuby/trunk/spec/macruby/library/dispatch/enumerable_spec.rb (3463 => 3464)


--- MacRuby/trunk/spec/macruby/library/dispatch/enumerable_spec.rb	2010-02-09 22:46:04 UTC (rev 3463)
+++ MacRuby/trunk/spec/macruby/library/dispatch/enumerable_spec.rb	2010-02-09 23:23:38 UTC (rev 3464)
@@ -22,7 +22,11 @@
       end
       
       it "should execute concurrently" do
-        true.should == true
+        t0 = Time.now
+        @ary.p_each {|v| sleep v/100.0}
+        t1 = Time.now
+        t_total = @ary.inject(0) {|a,b| a + b/100.0}
+        (t1-t0).to_f.should < t_total
       end
     end