module RSpec::Mocks::TestDoubleFormatter
@private
Constants
- IVAR_GET
@private
Public Class Methods
format(dbl, unwrap=false)
click to toggle source
# File lib/rspec/mocks/test_double.rb, line 137 def self.format(dbl, unwrap=false) format = "#{type_desc(dbl)}#{verified_module_desc(dbl)} #{name_desc(dbl)}" return format if unwrap "#<#{format}>" end
Private Class Methods
name_desc(dbl)
click to toggle source
# File lib/rspec/mocks/test_double.rb, line 163 def name_desc(dbl) return "(anonymous)" unless (name = IVAR_GET.bind(dbl).call(:@name)) name.inspect end
type_desc(dbl)
click to toggle source
# File lib/rspec/mocks/test_double.rb, line 146 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)
click to toggle source
# File lib/rspec/mocks/test_double.rb, line 158 def verified_module_desc(dbl) return nil unless VerifyingDouble === dbl "(#{IVAR_GET.bind(dbl).call(:@doubled_module).description})" end