class RSpec::Mocks::ConstantMutator::ConstantHider

@private
Hides a defined constant for the duration of an example.

def mutate

def mutate
  return unless @defined = recursive_const_defined?(full_constant_name)
  @context = recursive_const_get(@context_parts.join('::'))
  @original_value = get_const_defined_on(@context, @const_name)
  @context.__send__(:remove_const, @const_name)
end

def reset

def reset
  return unless @defined
  @context.const_set(@const_name, @original_value)
end

def to_constant

def to_constant
  return Constant.unmutated(full_constant_name) unless @defined
  const = super
  const.hidden = true
  const.previously_defined = true
  const
end