Class: CodeDrivenDevelopment::Stubber::NestedCallStubber

Inherits:
AbstractStubber show all
Defined in:
lib/code_driven_development/stubber/nested_call_stubber.rb

Instance Method Summary collapse

Methods inherited from AbstractStubber

#initialize, #method_name

Constructor Details

This class inherits a constructor from CodeDrivenDevelopment::Stubber::AbstractStubber

Instance Method Details

#beforesObject



12
13
14
# File 'lib/code_driven_development/stubber/nested_call_stubber.rb', line 12

def befores
  substubber.befores << "allow(#{substubber.method_name}).to receive(:#{method_name}).and_return(#{method_name})"
end

#bodyObject



16
17
18
# File 'lib/code_driven_development/stubber/nested_call_stubber.rb', line 16

def body
  substubber.body << "expect(#{substubber.method_name}).to have_received :#{method_name}"
end

#doublesObject



20
21
22
# File 'lib/code_driven_development/stubber/nested_call_stubber.rb', line 20

def doubles
  substubber.doubles << method_name.to_sym
end

#human_nameObject



8
9
10
# File 'lib/code_driven_development/stubber/nested_call_stubber.rb', line 8

def human_name
  "#{substubber.human_name}.#{method_name}"
end

#receiver_valueObject



4
5
6
# File 'lib/code_driven_development/stubber/nested_call_stubber.rb', line 4

def receiver_value
  receiver[2]
end