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

Merge pull request #309 from anomalousthought/reset_method

Add reset method to mock classes
This commit is contained in:
Wesley Beary 2011-05-18 14:50:51 -07:00
commit b5d28104a5
9 changed files with 42 additions and 0 deletions

View file

@ -33,6 +33,10 @@ module Fog
end end
end end
def self.reset
@data = nil
end
def initialize(options={}) def initialize(options={})
unless options.delete(:provider) unless options.delete(:provider)
location = caller.first location = caller.first

View file

@ -36,6 +36,10 @@ module Fog
end end
end end
def self.reset
@data = nil
end
def initialize(options={}) def initialize(options={})
unless options.delete(:provider) unless options.delete(:provider)
location = caller.first location = caller.first

View file

@ -31,6 +31,10 @@ module Fog
end end
end end
def self.reset
@data = nil
end
def initialize(options={}) def initialize(options={})
unless options.delete(:provider) unless options.delete(:provider)
location = caller.first location = caller.first

View file

@ -25,6 +25,10 @@ module Fog
end end
end end
def self.reset
@data = nil
end
def initialize(options={}) def initialize(options={})
unless options.delete(:provider) unless options.delete(:provider)
location = caller.first location = caller.first

View file

@ -53,6 +53,10 @@ module Fog
end end
end end
def self.reset
@data = nil
end
def initialize(options={}) def initialize(options={})
unless options.delete(:provider) unless options.delete(:provider)
location = caller.first location = caller.first

View file

@ -34,6 +34,10 @@ module Fog
end end
end end
def self.reset
@data = nil
end
def initialize(options={}) def initialize(options={})
unless options.delete(:provider) unless options.delete(:provider)
location = caller.first location = caller.first

View file

@ -56,6 +56,10 @@ module Fog
end end
end end
def self.reset
@data = nil
end
def self.reset_data(keys=data.keys) def self.reset_data(keys=data.keys)
for key in [*keys] for key in [*keys]
data.delete(key) data.delete(key)

View file

@ -48,6 +48,10 @@ module Fog
end end
end end
def self.reset
@data = nil
end
def initialize(options={}) def initialize(options={})
@voxel_api_key = options[:voxel_api_key] @voxel_api_key = options[:voxel_api_key]
@data = self.class.data[@voxel_api_key] @data = self.class.data[@voxel_api_key]

View file

@ -63,6 +63,16 @@ module Fog
selection selection
end end
def self.reset
providers = Fog.providers.map{|p| eval("Fog::#{p}")}
providers.select!{|m| m.constants.include?(:Compute)}
providers.each do |provider|
next unless provider::Compute::Mock.respond_to?(:reset)
provider::Compute::Mock.reset
end
end
end end
end end