class Crispy::CrispyInternal::Double

Constants

SPY_METHODS

Public Class Methods

new(name_or_stubs_map = nil, stubs_map = {}) click to toggle source
# File lib/crispy/crispy_internal/double.rb, line 7
def initialize name_or_stubs_map = nil, stubs_map = {}
  if name_or_stubs_map.is_a? ::Hash
    @name = ''.freeze
    spy_into_self_as_double(name_or_stubs_map)
  else
    @name = name_or_stubs_map
    spy_into_self_as_double(stubs_map)
  end
end

Public Instance Methods

received_messages() click to toggle source
# File lib/crispy/crispy_internal/double.rb, line 21
def received_messages
  @spy.received_messages
end
stub(*arguments, &definition) click to toggle source
# File lib/crispy/crispy_internal/double.rb, line 17
def stub *arguments, &definition
  @spy.stub(*arguments, &definition)
end

Private Instance Methods

spy_into_self_as_double(stubs_map) click to toggle source
# File lib/crispy/crispy_internal/double.rb, line 33
def spy_into_self_as_double stubs_map
  @spy = ::Crispy.spy_into(self, except: SPY_METHODS).stub(stubs_map)
end