class RSpec::Mocks::Constant

have been mutated by rspec-mocks.
Provides information about constants that may (or may not)

def self.original(name)

Returns:
  • (Constant) - an object contaning information about the named

Parameters:
  • name (String) -- the name of the constant
def self.original(name)
  mutator = ConstantMutator.find(name)
  mutator ? mutator.to_constant : unmutated(name)
end

def self.unmutated(name)

Other tags:
    Api: - private
def self.unmutated(name)
  const = new(name)
  const.previously_defined = recursive_const_defined?(name)
  const.stubbed = false
  const.hidden = false
  const.original_value = recursive_const_get(name) if const.previously_defined?
  const
end

def hidden?

Returns:
  • (Boolean) - Whether or not rspec-mocks has hidden
def hidden?
  @hidden
end

def initialize(name)

Other tags:
    Api: - private
def initialize(name)
  @name = name
  @previously_defined = false
  @stubbed = false
  @hidden = false
end

def mutated?

Returns:
  • (Boolean) - Whether or not rspec-mocks has mutated
def mutated?
  @stubbed || @hidden
end

def previously_defined?

Returns:
  • (Boolean) - Whether or not the constant was defined
def previously_defined?
  @previously_defined
end

def stubbed?

Returns:
  • (Boolean) - Whether or not rspec-mocks has stubbed
def stubbed?
  @stubbed
end

def to_s

def to_s
  "#<#{self.class.name} #{name}>"
end