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:
parent
bdc84813f9
commit
c30f077b71
1 changed files with 6 additions and 5 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue