test/helper.rb
# Briefly substitutes a new object in place of an existing constant.
Briefly substitutes a new object in place of an existing constant.
Briefly substitutes a new object in place of an existing constant .
def const_replace(name, object)
    original = Object.const_defined?(name) && Object.const_get(name)
    Object.send(:remove_const, name) if (original)
    Object.const_set(name, object)
    yield
  ensure
    Object.send(:remove_const, name)
    Object.const_set(name, original)
  end
def const_replace ( name , object ) original = Object . const_defined? ( name ) && Object . const_get ( name ) Object . send ( :remove_const , name ) if ( original ) Object . const_set ( name , object ) yield ensure Object . send ( :remove_const , name ) Object . const_set ( name , original ) end
Briefly substitutes a new object in place of an existing constant.
Briefly substitutes a new object in place of an existing constant .
name
object