Class: Shoulda::Matchers::Doublespeak::StubImplementation
- Inherits:
-
Object
- Object
- Shoulda::Matchers::Doublespeak::StubImplementation
- Defined in:
- lib/shoulda/matchers/doublespeak/stub_implementation.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call(call) ⇒ Object
-
#initialize ⇒ StubImplementation
constructor
A new instance of StubImplementation.
- #returns(value = nil, &block) ⇒ Object
Constructor Details
#initialize ⇒ StubImplementation
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
.create ⇒ Object
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 |