Parent

Files

Caricature::ArgumentRecording

A recording of an argument variation. Every time a method is called with different arguments the method call recorder will create an ArgumentVariation these variations are used later in the assertion to verify against specific argument values

Attributes

args[RW]

contains the arguments of the recorded parameters

block[RW]

contains the block for the recorded parameters

call_number[RW]

the number of the call that has the following parameters

blocks[R]

the collection of block calls variations on this argument variation

Public Class Methods

new(args=[], call_number=1, block=nil) click to toggle source

initializes a new instance of an argument recording. configures it with 1 call count and the args as an Array

    # File lib/caricature/method_call_recorder.rb, line 43
43:     def initialize(args=[], call_number=1, block=nil)
44:       @args = args
45:       @block = block
46:       @blocks = []
47:       @call_number = call_number
48:     end

Public Instance Methods

==(other) click to toggle source

compares one argument variation to another. Also takes an array as an argument

    # File lib/caricature/method_call_recorder.rb, line 66
66:     def ==(other)
67:       other = self.class.new(other) if other.respond_to?(:each)
68:       return true if other.args.first.is_a?(Symbol) and other.args.first == :any 
69:       other.args == args
70:     end
add_block_variation(*args) click to toggle source
    # File lib/caricature/method_call_recorder.rb, line 50
50:     def add_block_variation(*args)
51:       bv = find_block_variation(*args)
52:       if bv.empty?
53:         blocks << BlockCallRecording.new(*args)
54:       else
55:         bv.first.call_number += 1
56:       end
57:     end
find_block_variation(*args) click to toggle source
    # File lib/caricature/method_call_recorder.rb, line 59
59:     def find_block_variation(*args)
60:       return @blocks if args.last.is_a?(Symbol) and args.last == :any
61:       @blocks.select { |bv| bv.args == args }
62:     end
inspect() click to toggle source
Alias for: to_s
to_s() click to toggle source
    # File lib/caricature/method_call_recorder.rb, line 72
72:     def to_s
73:       "<ArgumentRecording @args=#{args}, @block= #{block}, @call_number=#{call_number}"
74:     end
Also aliased as: inspect

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.