spec/ztk/rescue_retry_spec.rb in ztk-1.6.20 vs spec/ztk/rescue_retry_spec.rb in ztk-1.6.21

- old
+ new

@@ -74,17 +74,30 @@ end it "should call our lambda when it catches an exception and retries" do $counter = 0 on_retry_m = lambda { |exception| - $counter +=1 + $counter += 1 } lambda { ZTK::RescueRetry.try(:tries => 3, :on => EOFError, :on_retry => on_retry_m) do raise EOFError end }.should raise_error EOFError $counter.should == 2 + end + + it "should not retry exceptions that are ignored" do + $counter = 0 + + lambda { + ZTK::RescueRetry.try(:tries => 3, :raise => EOFError) do + $counter += 1 + raise EOFError + end + }.should raise_error EOFError + + $counter.should == 1 end end end