spec/spec_helper.rb
def wait_until(timeout=10, &block)
  time_to_stop = Time.now + timeout
  until yield do 
    break if Time.now > time_to_stop
    sleep 0.3
  end
end
# method to wait until block passed returns true or timeout (default is 10 seconds) is reached 
method to wait until block passed returns true or timeout (default is 10 seconds) is reached
method to wait until block passed returns true or timeout ( default is 10 seconds ) is reached
def wait_until(timeout=10, &block)
  time_to_stop = Time.now + timeout
  until yield do 
    break if Time.now > time_to_stop
    sleep 0.3
  end
end
def wait_until ( timeout = 10 , & block ) time_to_stop = Time . now + timeout until yield do break if Time . now > time_to_stop sleep 0.3 end end
method to wait until block passed returns true or timeout (default is 10 seconds) is reached
method to wait until block passed returns true or timeout ( default is 10 seconds ) is reached
timeout
block