Parent

Caricature::MethodCallRecording

A recording that represents a method call it contains argument variations that can be matched too

Attributes

method_name[RW]

gets or sets the method name

count[RW]

gets or sets the amount of times the method was called

args[RW]

gets or sets the arguments for this method call

block[RW]

gets or sets the block for this method call

Public Class Methods

new(method_name, count=0) click to toggle source

Initializes a new instance of a method call recording every time a method gets called in an isolated object this gets stored in the method call recorder It expects a method_name at the very least.

# File lib/caricature/method_call_recorder.rb, line 56
    def initialize(method_name, count=0)
      @method_name = method_name
      @count = count
      @variations = []
    end

Public Instance Methods

add_argument_variation(args, block) click to toggle source

add an argument variation

# File lib/caricature/method_call_recorder.rb, line 73
    def add_argument_variation(args, block)
      variation = find_argument_variations args
      @variations << ArgumentRecording.new(args, @variations.size+1, block) if variation == []
    end
args() click to toggle source

add args

# File lib/caricature/method_call_recorder.rb, line 63
    def args
      @variations
    end
find_argument_variations(args) click to toggle source

finds an argument variation that matches the provided args

# File lib/caricature/method_call_recorder.rb, line 79
    def find_argument_variations(args)
      return @variations if args.first == :any
      @variations.select { |ar| ar.args == args }
    end
has_argument_variations?() click to toggle source

indicates if it has an argument variation

# File lib/caricature/method_call_recorder.rb, line 68
    def has_argument_variations?
      @variations.size > 1
    end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.