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

Add a reset method to Fog::Mock that resets all providers/services in addition to Compute providers.

This commit is contained in:
anomalousthought 2011-05-19 10:06:02 -04:00
parent bdc84813f9
commit c30f077b71

View file

@ -65,11 +65,12 @@ module Fog
def self.reset
providers = Fog.providers.map{|p| eval("Fog::#{p}")}
providers.select!{|m| m.constants.include?(:Compute)}
services = providers.map{|p| p.constants.map{|s| eval("#{p}::#{s}")}}.flatten
services.select!{|s| s.constants.include?(:Mock)}
providers.each do |provider|
next unless provider::Compute::Mock.respond_to?(:reset)
provider::Compute::Mock.reset
services.each do |service|
next unless service::Mock.respond_to?(:reset)
service::Mock.reset
end
end