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