class RSpec::Mocks::ConstantMutator::ConstantHider
Hides a defined constant for the duration of an example.
@private
Public Instance Methods
Source
# File lib/rspec/mocks/mutate_const.rb, line 196 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) record_original_source_location @context.__send__(:remove_const, @const_name) end
Source
# File lib/rspec/mocks/mutate_const.rb, line 215 def reset return unless @defined restore_original_value end
Source
# File lib/rspec/mocks/mutate_const.rb, line 205 def to_constant return Constant.unmutated(full_constant_name) unless @defined const = super const.hidden = true const.previously_defined = true const end
Calls superclass method
RSpec::Mocks::ConstantMutator::BaseMutator#to_constant