class RSpec::Mocks::Constant
have been mutated by rspec-mocks.
Provides information about constants that may (or may not)
def self.original(name)
-
(Constant)
- an object containing information about the named
Parameters:
-
name
(String
) -- the name of the constant
def self.original(name) mutator = ::RSpec::Mocks.space.constant_mutator_for(name) mutator ? mutator.to_constant : unmutated(name) end
def self.unmutated(name)
- Private: -
def self.unmutated(name) previously_defined = !!recursive_const_defined?(name) rescue NameError new(name) do |c| c.valid_name = false end else new(name) do |const| const.previously_defined = previously_defined const.original_value = recursive_const_get(name) if previously_defined end end
def hidden?
-
(Boolean)
- Whether or not rspec-mocks has hidden
def hidden? @hidden end
def initialize(name)
- Api: - private
def initialize(name) @name = name @previously_defined = false @stubbed = false @hidden = false @valid_name = true yield self if block_given? end
def mutated?
-
(Boolean)
- Whether or not rspec-mocks has mutated
def mutated? @stubbed || @hidden end
def previously_defined?
-
(Boolean)
- Whether or not the constant was defined
def previously_defined? @previously_defined end
def stubbed?
-
(Boolean)
- Whether or not rspec-mocks has stubbed
def stubbed? @stubbed end
def to_s
def to_s "#<#{self.class.name} #{name}>" end
def valid_name?
-
(Boolean)
- Whether or not the provided constant name
def valid_name? @valid_name end