spec/parallel_spec.rb in grosser-parallel-0.3.0 vs spec/parallel_spec.rb in grosser-parallel-0.3.1

- old
+ new

@@ -35,10 +35,15 @@ it "saves time" do t = Time.now `ruby spec/cases/parallel_sleeping_2.rb` Time.now.should be_close(t, 3) end + + it "raises when one of the processes raises" do + pending 'there is some kind of error, but not the original...' + `ruby spec/cases/parallel_raise.rb`.should == 'TEST' + end end describe :in_threads do it "saves time" do t = Time.now @@ -51,10 +56,14 @@ end it "returns results as array" do Parallel.in_threads(4){|i| "XXX#{i}"}.should == ["XXX0",'XXX1','XXX2','XXX3'] end + + it "raises when a thread raises" do + lambda{ Parallel.in_threads(2){|i| raise "TEST"} }.should raise_error("TEST") + end end describe :map do it "saves time" do t = Time.now @@ -62,9 +71,15 @@ Time.now.should be_close(t, 3) end it "executes with given parameters" do `ruby spec/cases/parallel_map.rb`.should == "-a- -b- -c- -d-" + end + + it "starts new process imediatly when old exists" do + t = Time.now + `ruby spec/cases/parallel_map_uneven.rb` + Time.now.should be_close(t, 3) end it "does not flatten results" do Parallel.map([1,2,3], :in_threads=>2){|x| [x,x]}.should == [[1,1],[2,2],[3,3]] end \ No newline at end of file