Class: Crispy::CrispyInternal::Double

Inherits:
Object
  • Object
show all
Defined in:
lib/crispy/crispy_internal/double.rb

Instance Method Summary collapse

Constructor Details

#initialize(name_or_stubs_map = nil, stubs_map = {}) ⇒ Double

Returns a new instance of Double.



5
6
7
8
9
10
11
12
13
# File 'lib/crispy/crispy_internal/double.rb', line 5

def initialize name_or_stubs_map = nil, stubs_map = {}
  if name_or_stubs_map.is_a? ::Hash
    @name = ''.freeze
    @spy = ::Crispy.spy_into(self, name_or_stubs_map)
  else
    @name = name_or_stubs_map
    @spy = ::Crispy.spy_into(self, stubs_map)
  end
end

Instance Method Details

#received_messagesObject



19
20
21
# File 'lib/crispy/crispy_internal/double.rb', line 19

def received_messages
  @spy.received_messages
end

#stub(*arguments, &definition) ⇒ Object



15
16
17
# File 'lib/crispy/crispy_internal/double.rb', line 15

def stub *arguments, &definition
  @spy.stub(*arguments, &definition)
end