Sha256: 4b256227d1a4a01dd465818463bce758c1b8ba5702c7602ce760d40bbcc0a12b

Contents?: true

Size: 508 Bytes

Versions: 3

Compression:

Stored size: 508 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}) { i += 1; i > 1 }
    assert_equal({:duration => 1}, ret)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fog-core-1.24.0 spec/wait_for_spec.rb
fog-core-1.23.0 spec/wait_for_spec.rb
fog-core-1.22.0 spec/wait_for_spec.rb