Class: Shoulda::Matchers::Doublespeak::ProxyImplementation

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/shoulda/matchers/doublespeak/proxy_implementation.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stub_implementation) ⇒ ProxyImplementation

Returns a new instance of ProxyImplementation.



16
17
18
# File 'lib/shoulda/matchers/doublespeak/proxy_implementation.rb', line 16

def initialize(stub_implementation)
  @stub_implementation = stub_implementation
end

Class Method Details

.createObject



12
13
14
# File 'lib/shoulda/matchers/doublespeak/proxy_implementation.rb', line 12

def self.create
  new(StubImplementation.new)
end

Instance Method Details

#call(call) ⇒ Object



20
21
22
23
24
# File 'lib/shoulda/matchers/doublespeak/proxy_implementation.rb', line 20

def call(call)
  return_value = call.double.call_original_method(call)
  stub_implementation.call(call.with_return_value(return_value))
  return_value
end