Parent

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
    def initialize(method_name, recorder, mode=:instance)
      @method_name, @args, @any_args, @recorder, @mode = method_name, [], true, recorder, mode
    end

Public Instance Methods

allow_any_arguments() click to toggle source

allow any arguments ignore the argument constraint

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

indicates whether this verification can be for any arguments

# File lib/caricature/verification.rb, line 13
    def any_args?
      @any_args
    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 31
    def matches?(method_name, *args)
      @method_name == method_name and any_args? or @args == args
    end
successful?() click to toggle source

indicate that this method verification is successful

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

constrain this verification to the provided arguments

# File lib/caricature/verification.rb, line 18
    def with(*args)
      @any_args = args.first.is_a?(Symbol) and args.first == :any
      @args = args
      self
    end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.