class RSpec::Mocks::ConstantMutator::BaseMutator
Contains common functionality used by all of the constant mutators.
@private
Attributes
full_constant_name[R]
original_value[R]
Public Class Methods
new(full_constant_name, mutated_value, transfer_nested_constants)
click to toggle source
# File lib/rspec/mocks/mutate_const.rb, line 140 def initialize(full_constant_name, mutated_value, transfer_nested_constants) @full_constant_name = normalize_const_name(full_constant_name) @mutated_value = mutated_value @transfer_nested_constants = transfer_nested_constants @context_parts = @full_constant_name.split('::') @const_name = @context_parts.pop @reset_performed = false end
Public Instance Methods
idempotently_reset()
click to toggle source
# File lib/rspec/mocks/mutate_const.rb, line 156 def idempotently_reset reset unless @reset_performed @reset_performed = true end
to_constant()
click to toggle source
# File lib/rspec/mocks/mutate_const.rb, line 149 def to_constant const = Constant.new(full_constant_name) const.original_value = original_value const end