class RSpec::Mocks::ConstantMutator::DefinedConstantReplacer
def verify_constants_to_transfer!
def verify_constants_to_transfer! return [] unless should_transfer_nested_constants? { @original_value => "the original value", @mutated_value => "the stubbed value" }.each do |value, description| next if value.respond_to?(:constants) raise ArgumentError, "Cannot transfer nested constants for #{@full_constant_name} " \ "since #{description} is not a class or module and only classes " \ "and modules support nested constants." end if Array === @transfer_nested_constants @transfer_nested_constants = @transfer_nested_constants.map(&:to_s) if RUBY_VERSION == '1.8.7' undefined_constants = @transfer_nested_constants - constants_defined_on(@original_value) if undefined_constants.any? available_constants = constants_defined_on(@original_value) - @transfer_nested_constants raise ArgumentError, "Cannot transfer nested constant(s) #{undefined_constants.join(' and ')} " \ "for #{@full_constant_name} since they are not defined. Did you mean " \ "#{available_constants.join(' or ')}?" end @transfer_nested_constants else constants_defined_on(@original_value) end end