Provides information about constants that may (or may not) have been stubbed by rspec-mocks.
@return [String] The fully qualified name of the constant.
@return [Object, nil] The original value (e.g. before it
was stubbed by rspec-mocks) of the constant, or nil if the constant was not previously defined.
@api private
@api private
@api private
# File lib/rspec/mocks/stub_const.rb, line 78 def initialize(name) @name = name end
Queries rspec-mocks to find out information about the named constant.
@param [String] name the name of the constant @return [Constant] an object contaning information about the named
constant.
# File lib/rspec/mocks/stub_const.rb, line 126 def self.original(name) stubber = ConstantStubber.find(name) stubber ? stubber.to_constant : unstubbed(name) end
@return [Boolean] Whether or not the constant was defined
before the current example.
# File lib/rspec/mocks/stub_const.rb, line 95 def previously_defined? @previously_defined end
@return [Boolean] Whether or not rspec-mocks has stubbed
this constant.
# File lib/rspec/mocks/stub_const.rb, line 101 def stubbed? @stubbed end
# File lib/rspec/mocks/stub_const.rb, line 105 def to_s "#<#{self.class.name} #{name}>" end