Describes a verification of a method call. This corresponds kind of to an assertion
Describes a verification of a method call. This corresponds kind of to an assertion
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, @block_args = method_name, [], true, recorder, mode, nil 10: init_plugin 11: end
allow any arguments ignore the argument constraint
# File lib/caricature/verification.rb, line 35 35: def allow_any_arguments 36: @any_args = true 37: self 38: end
indicates whether this verification can be for any arguments
# File lib/caricature/verification.rb, line 18 18: def any_args? 19: @any_args 20: end
# File lib/caricature/verification.rb, line 45 45: def error 46: @recorder.error 47: end
# File lib/caricature/verification.rb, line 13 13: def init_plugin 14: 15: end
figure out if this argument variation matches the provided args.
# File lib/caricature/verification.rb, line 41 41: def matches?(method_name, *args) 42: @method_name == method_name and any_args? or @args == args 43: end
indicate that this method verification is successful
# File lib/caricature/bacon/integration.rb, line 43 43: def successful? 44: a = any_args? ? [:any] : @args 45: res = @recorder.was_called?(@method_name, @block_args, @mode, *a) 46: raise Caricature::ArgumentMatchError.new(:failed, self.error) unless res 47: res 48: end
indicate that this method verification is successful
# File lib/caricature/verification.rb, line 50 50: def successful? 51: a = any_args? ? [:any] : @args 52: begin 53: @recorder.was_called?(@method_name, @block_args, @mode, *a) 54: rescue ArgumentError 55: false 56: end 57: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.