Sha256: 87d28ed93e56503820eecd3a5781aaba6994dad6ea886fab00e3a59846352a0b

Contents?: true

Size: 532 Bytes

Versions: 8

Compression:

Stored size: 532 Bytes

Contents

require "spec_helper"

describe "Fog#wait_for" do
  it "returns a Hash indicating the wait duration if successful" do
    assert_equal({ :duration => 0 }, Fog.wait_for(1) { true })
  end

  it "raises if the wait timeout is exceeded" do
    assert_raises(Fog::Errors::TimeoutError) do
      Fog.wait_for(2) { false }
    end
  end

  it "accepts a proc to determine the sleep interval" do
    i = 0
    ret = Fog.wait_for(1, lambda { |_t| 1 }) do
      i += 1
      i > 1
    end
    assert_equal({ :duration => 1 }, ret)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fog-core-1.29.0 spec/wait_for_spec.rb
fog-core-1.28.0 spec/wait_for_spec.rb
fog-core-1.27.4 spec/wait_for_spec.rb
fog-core-1.27.3 spec/wait_for_spec.rb
fog-core-1.27.2 spec/wait_for_spec.rb
fog-core-1.27.1 spec/wait_for_spec.rb
fog-core-1.27.0 spec/wait_for_spec.rb
fog-core-1.25.0 spec/wait_for_spec.rb