Sha256: 08152efa012ba939145762df2fbbfd8d1c82ab040dedb29a71401b65881c20ed
Contents?: true
Size: 614 Bytes
Versions: 3
Compression:
Stored size: 614 Bytes
Contents
require 'singleton' module Fakes class ClassSwaps include Singleton attr_reader :swaps def initialize @swaps = {} end def add_fake_for(klass,the_fake) symbol = klass.name.to_sym ensure_swap_does_not_already_exist_for(symbol) swap = ClassSwap.new(klass,the_fake) @swaps[symbol] = swap swap.initiate end def ensure_swap_does_not_already_exist_for(symbol) raise "A swap already exists for the class #{symbol}" if @swaps.has_key?(symbol) end def reset @swaps.values.each{|item| item.reset} @swaps.clear end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fakes-1.1.6 | lib/fakes/class_swaps.rb |
fakes-1.1.5 | lib/fakes/class_swaps.rb |
fakes-1.1.4 | lib/fakes/class_swaps.rb |