Parent

Included Modules

Caricature::Expectation

A description of an expectation. An expectation has the power to call the proxy method or completely ignore it

Attributes

method_name[R]

gets the method_name to which this expectation needs to listen to

args[R]

the arguments that this expectation needs to be constrained by

error_args[R]

the error_args that this expectation will raise an error with

return_value[R]

the value that this expecation will return when executed

super[R]

indicator for the mode to call the super :before, :after and nil

Public Class Methods

new(method_name, args, error_args, return_value, super_mode) click to toggle source

Initializes a new instance of an expectation

# File lib/caricature/expectation.rb, line 98
    def initialize(method_name, args, error_args, return_value, super_mode)
      @method_name, @args, @error_args, @return_value, @super =
              method_name, args, error_args, return_value, super_mode
      @any_args = true
    end

Public Instance Methods

call_super?() click to toggle source

indicates whether super needs to be called somewhere

# File lib/caricature/expectation.rb, line 120
    def call_super?
      !@super.nil?
    end
execute(*margs) click to toggle source

executes this expectation with its configuration

# File lib/caricature/expectation.rb, line 125
    def execute(*margs)
      ags = any_args? ? (margs.empty? ? :any : margs) : args
      raise *@error_args if has_error_args?
      return return_value if has_return_value?
      nil
    end
has_error_args?() click to toggle source

indicates whether this expecation will raise an event.

# File lib/caricature/expectation.rb, line 105
    def has_error_args?
      !@error_args.nil?
    end
has_return_value?() click to toggle source

indicates whether this expectation will return a value.

# File lib/caricature/expectation.rb, line 110
    def has_return_value?
      !@return_value.nil?
    end
super_before?() click to toggle source

call the super before the expectation

# File lib/caricature/expectation.rb, line 115
    def super_before?
      @super == :before
    end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.