Sha256: e38732395e5b6c3ff4cda76cf6060b3227baf8ba2508e5d4ff175e6aa35b1586

Contents?: true

Size: 778 Bytes

Versions: 62

Compression:

Stored size: 778 Bytes

Contents

require 'spec_helper'

describe S3Website::Retry do
  describe ".run_with_retry" do
    it "retry the operation 4 times" do
      retries = 0
      begin
        S3Website::Retry.run_with_retry(0.001) {
          retries += 1
          raise Exception
        }
      rescue
      end
      retries.should be(4)
    end

    it "throws an error if all retries fail" do
      expect {
        S3Website::Retry.run_with_retry(0.001) {
          raise Exception
        }
      }.to raise_error(S3Website::RetryAttemptsExhaustedError)
    end

    it "re-runs the block if the block throws an error" do
      retries = 0
      S3Website::Retry.run_with_retry(0.001) {
        retries += 1
        raise Exception if retries < 2
      }
      retries.should be(2)
    end
  end
end

Version data entries

62 entries across 62 versions & 2 rubygems

Version Path
s3_website-1.8.2 spec/lib/retry_spec.rb
s3_website-1.8.1 spec/lib/retry_spec.rb
s3_website-1.8.0 spec/lib/retry_spec.rb
s3_website_monadic-0.0.15 spec/lib/retry_spec.rb
s3_website_monadic-0.0.14 spec/lib/retry_spec.rb
s3_website_monadic-0.0.13 spec/lib/retry_spec.rb
s3_website_monadic-0.0.12 spec/lib/retry_spec.rb
s3_website_monadic-0.0.11 spec/lib/retry_spec.rb
s3_website_monadic-0.0.9 spec/lib/retry_spec.rb
s3_website_monadic-0.0.8 spec/lib/retry_spec.rb
s3_website_monadic-0.0.7 spec/lib/retry_spec.rb
s3_website_monadic-0.0.6 spec/lib/retry_spec.rb
s3_website_monadic-0.0.5 spec/lib/retry_spec.rb
s3_website-1.7.6 spec/lib/retry_spec.rb
s3_website_monadic-0.0.4 spec/lib/retry_spec.rb
s3_website_monadic-0.0.3 spec/lib/retry_spec.rb
s3_website-1.7.5 spec/lib/retry_spec.rb
s3_website_monadic-0.0.2 spec/lib/retry_spec.rb
s3_website_monadic-0.0.1 spec/lib/retry_spec.rb
s3_website-1.7.4 spec/lib/retry_spec.rb