Class: Shoulda::Matchers::Doublespeak::StubImplementation

Inherits:
Object
  • Object
show all
Defined in:
lib/shoulda/matchers/doublespeak/stub_implementation.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStubImplementation

Returns a new instance of StubImplementation.



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

def initialize
  @implementation = proc { nil }
end

Class Method Details

.createObject



8
9
10
# File 'lib/shoulda/matchers/doublespeak/stub_implementation.rb', line 8

def self.create
  new
end

Instance Method Details

#call(call) ⇒ Object



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

def call(call)
  call.double.record_call(call)
  implementation.call(call)
end

#returns(value = nil, &block) ⇒ Object



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

def returns(value = nil, &block)
  @implementation = block || proc { value }
end