Parent

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
    def initialize(expectations, instance=nil)
      @instance, @expectations = instance, expectations
    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
    def deliver(method_name, return_type, *args, &b)
      internal_deliver(:instance, method_name, return_type, *args, &b)
    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 24
    def deliver_to_class(method_name, return_type, *args, &b)
      internal_deliver(:class, method_name, return_type, *args, &b)
    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 31
      def internal_deliver(mode, method_name, return_type, *args, &b)
        raise NotImplementedError.new("Override in an implementing class")
      end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.