1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/spec/spec_helper.rb

43 lines
690 B
Ruby
Raw Normal View History

2009-05-18 03:13:06 -04:00
require 'spec'
require 'open-uri'
2010-08-20 14:07:21 -04:00
require 'fog'
2010-09-23 13:48:52 -04:00
Fog.bin = true
require 'fog/core/bin'
2010-08-20 14:07:21 -04:00
require 'fog/vcloud/bin'
2010-04-26 19:03:55 -04:00
if ENV["FOG_MOCK"] == "true"
Fog.mock!
end
2009-05-19 02:06:49 -04:00
2009-07-25 21:05:49 -04:00
def eventually(max_delay = 16, &block)
delays = [0]
delay_step = 1
total = 0
while true
delay = 1
delay_step.times do
delay *= 2
end
delays << delay
delay_step += 1
break if delay >= max_delay
end
delays.each do |delay|
2009-07-16 02:37:22 -04:00
begin
sleep(delay)
yield
break
rescue => error
2009-07-25 21:05:49 -04:00
raise error if delay >= max_delay
2009-07-16 02:37:22 -04:00
end
2009-05-19 02:06:49 -04:00
end
end
unless defined?(GENTOO_AMI)
GENTOO_AMI = 'ami-5ee70037'
end
def lorem_file
File.open(File.dirname(__FILE__) + '/lorem.txt', 'r')
end