Parent

Files

Caricature::Verification

Describes a verification of a method call. This corresponds kind of to an assertion

Public Class Methods

new(method_name, recorder, mode=:instance) click to toggle source

Initializes a new instance of a Verification

    # File lib/caricature/verification.rb, line 8
 8:     def initialize(method_name, recorder, mode=:instance)
 9:       @method_name, @args, @any_args, @recorder, @mode = method_name, [], true, recorder, mode
10:     end

Public Instance Methods

allow_any_arguments() click to toggle source

allow any arguments ignore the argument constraint

    # File lib/caricature/verification.rb, line 26
26:     def allow_any_arguments
27:       @any_args = true
28:       self
29:     end
any_args?() click to toggle source

indicates whether this verification can be for any arguments

    # File lib/caricature/verification.rb, line 13
13:     def any_args?
14:       @any_args
15:     end
matches?(method_name, *args) click to toggle source

figure out if this argument variation matches the provided args.

    # File lib/caricature/verification.rb, line 32
32:     def matches?(method_name, *args)
33:       @method_name == method_name and any_args? or @args == args
34:     end
successful?() click to toggle source

indicate that this method verification is successful

    # File lib/caricature/verification.rb, line 37
37:     def successful?
38:       a = any_args? ? [:any] : @args
39:       @recorder.was_called?(@method_name, @mode, *a)
40:     end
with(*args) click to toggle source

constrain this verification to the provided arguments

    # File lib/caricature/verification.rb, line 18
18:     def with(*args)
19:       @any_args = args.first.is_a?(Symbol) and args.first == :any
20:       @args = args 
21:      # @callback = b if b

22:       self
23:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.