lib/polonium/wait_for.rb in polonium-0.1.1 vs lib/polonium/wait_for.rb in polonium-0.2.0
- old
+ new
@@ -10,10 +10,13 @@
timeout = params[:timeout] || default_wait_for_time
message = params[:message] || "Timeout exceeded"
configuration = Context.new(message)
begin_time = time_class.now
while (time_class.now - begin_time) < timeout
- return if yield(configuration)
+ if value = yield(configuration)
+ return value
+ end
+ return value if value
sleep 0.25
end
flunk(configuration.message + " (after #{timeout} sec)")
true
end
\ No newline at end of file