Parent

Files

Caricature::Messenger

A base class to encapsulate method invocation

Attributes

instance[R]

the real instance of the isolated subject used to forward calls in partial mocks

expectations[R]

the expecations that have been set for the isolation

Public Class Methods

new(expectations, instance=nil) click to toggle source

creates a new instance of this messaging strategy

    # File lib/caricature/messenger.rb, line 14
14:     def initialize(expectations, instance=nil)
15:       @instance, @expectations = instance, expectations
16:     end

Public Instance Methods

deliver(method_name, return_type, *args, &b) click to toggle source

deliver the message to the receiving isolation

    # File lib/caricature/messenger.rb, line 19
19:     def deliver(method_name, return_type, *args, &b)
20:       
21:       internal_deliver(:instance, method_name, return_type, *args, &b)
22:     end
deliver_to_class(method_name, return_type, *args, &b) click to toggle source

deliver the message to class of the receiving isolation

    # File lib/caricature/messenger.rb, line 25
25:     def deliver_to_class(method_name, return_type, *args, &b)
26:       internal_deliver(:class, method_name, return_type, *args, &b)
27:     end

Protected Instance Methods

internal_deliver(mode, method_name, return_type, *args, &b) click to toggle source

template method for looking up the expectation and/or returning a value

    # File lib/caricature/messenger.rb, line 32
32:       def internal_deliver(mode, method_name, return_type, *args, &b)
33:         raise NotImplementedError.new("Override in an implementing class")
34:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.