[rspec] Waiting docker container to continue tests

2018-04-06 Thread Samuel Mutel
Hello, I am currently using rspec and docker api to test docker container (@container = Docker::Container.create & @container.start). I would like to know if it is possible to wait a condition (port available for example) to continue the test suite? I saw this module rspec-wait ... Thanks. --

Re: [rspec] Waiting docker container to continue tests

2018-04-06 Thread Myron Marston
RSpec doesn’t have any built-in features for what you’re asking for, but it’s easy enough to write it yourself: require 'timeout' module WaitHelpers def wait_until(timeout) timeout_time = Time.now + timeout loop do sleep 0.1 return if yield raise Timeout::Error if Time.