Skip to content

Instantly share code, notes, and snippets.

Avatar

Saumya Negi xam7247

  • Mindtree Ltd
  • Manchester, UK
View GitHub Profile
@xam7247
xam7247 / async_helper.txt
Last active Jun 1, 2016 — forked from mattwynne/gist:1228927
eventually helper method for making assertions against asynchronous systems
View async_helper.txt
# usage:
# it "should return a result of 5" do
# eventually { long_running_thing.result.should eq(5) }
# end
module AsyncHelper
def eventually(options = {})
timeout = options[:timeout] || 2
interval = options[:interval] || 0.1
time_limit = Time.now + timeout
You can’t perform that action at this time.