mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[mock] fix Fog::Mock.reset
This commit is contained in:
parent
4b3e9dc462
commit
63b9ea6eb0
1 changed files with 9 additions and 7 deletions
|
@ -64,13 +64,15 @@ module Fog
|
|||
end
|
||||
|
||||
def self.reset
|
||||
providers = Fog.providers.map{|p| eval("Fog::#{p}")}
|
||||
services = providers.map{|p| p.constants.map{|s| eval("#{p}::#{s}")}}.flatten
|
||||
services = services.select {|s| s.constants.include?(:Mock)}
|
||||
providers = Fog.providers.map {|p| Fog.const_get(p) }
|
||||
possible_service_constants = providers.map {|p| p.constants.map {|c| p.const_get(c) } }.flatten
|
||||
# c.to_sym is 1.8.7 / 1.9.2 compat
|
||||
services = possible_service_constants.select {|s| s.constants.map {|c| c.to_sym }.include?(:Mock) }
|
||||
service_mocks = services.map {|s| s.const_get(:Mock) }
|
||||
|
||||
services.each do |service|
|
||||
next unless service::Mock.respond_to?(:reset)
|
||||
service::Mock.reset
|
||||
service_mocks.each do |service_mock|
|
||||
next unless service_mock.respond_to?(:reset)
|
||||
service_mock.reset
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue