123456789_123456789_123456789_123456789_123456789_

Module: RSpec::Mocks::TestDoubleFormatter Private

Do not use. This module is for internal use only.
Relationships & Source Files
Defined in: rspec-mocks/lib/rspec/mocks/test_double.rb

Constant Summary

Class Method Summary

Class Method Details

.format(dbl, unwrap = false)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/test_double.rb', line 138

def self.format(dbl, unwrap=false)
  format = "#{type_desc(dbl)}#{verified_module_desc(dbl)} #{name_desc(dbl)}"
  return format if unwrap
  "#<#{format}>"
end

.name_desc(dbl) (private)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/test_double.rb', line 164

def name_desc(dbl)
  return "(anonymous)" unless (name = IVAR_GET.bind(dbl).call(:@name))
  name.inspect
end

.type_desc(dbl) (private)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/test_double.rb', line 147

def type_desc(dbl)
  case dbl
  when InstanceVerifyingDouble then "InstanceDouble"
  when ClassVerifyingDouble    then "ClassDouble"
  when ObjectVerifyingDouble   then "ObjectDouble"
  else "Double"
  end
end

.verified_module_desc(dbl) (private)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/test_double.rb', line 159

def verified_module_desc(dbl)
  return nil unless VerifyingDouble === dbl
  "(#{IVAR_GET.bind(dbl).call(:@doubled_module).description})"
end