Sha256: a1f714512efd8727fdb3ca662be8a4245f85809b1f350397d139e5dae9059ec9

Contents?: true

Size: 672 Bytes

Versions: 10

Compression:

Stored size: 672 Bytes

Contents

require 'spec_helper'

include Gametel::Waiter

describe Gametel::Waiter do
  before(:each) do
    ::Time.stub(:now).and_return(100)
    self.stub(:sleep)
  end

  it "should wait for your condition" do
    screen = double("fake screen")
    screen.should_receive(:predicate?).and_return(false, false, true)
    self.should_receive(:sleep).exactly(2)
    wait_until(2) { screen.predicate? }
  end

  it "is not as forgiving if you make it wait" do
    lambda { wait_until(0) }.should raise_error
  end

  it "can be told what it is waiting on" do
    lambda { wait_until(0, "something to happen") }.should raise_error "Timed out waiting for something to happen"
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
gametel-0.8 spec/lib/gametel/waiter_spec.rb
gametel-0.7 spec/lib/gametel/waiter_spec.rb
gametel-0.6 spec/lib/gametel/waiter_spec.rb
gametel-0.5.9.3 spec/lib/gametel/waiter_spec.rb
gametel-0.5.9.2 spec/lib/gametel/waiter_spec.rb
gametel-0.5.9.1 spec/lib/gametel/waiter_spec.rb
gametel-0.5.9 spec/lib/gametel/waiter_spec.rb
gametel-0.5.8.1 spec/lib/gametel/waiter_spec.rb
gametel-0.5.8 spec/lib/gametel/waiter_spec.rb
gametel-0.5.7 spec/lib/gametel/waiter_spec.rb