class RSpec::Mocks::Constant

have been stubbed 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)
  stubber = ConstantStubber.find(name)
  stubber ? stubber.to_constant : unstubbed(name)
end

def self.unstubbed(name)

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

def initialize(name)

Other tags:
    Api: - private
def initialize(name)
  @name = name
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