Files

Caricature::ExpectationSyntax

contains the syntax for building up an expectation This is shared between the ExpecationBuilder and the Expectation

Public Instance Methods

actual_raise(*args) click to toggle source

tell the expectation it needs to raise an error with the specified arguments

Alias for: raise
any_args?() click to toggle source

indicates whether this expectation should match with any arguments or only for the specified arguments

    # File lib/caricature/expectation.rb, line 89
89:     def any_args?
90:       collected[:any_args]
91:     end
pass_block(*ags, &b) click to toggle source

Sets up arguments for the block that is being passed into the isolated method call

    # File lib/caricature/expectation.rb, line 59
59:     def pass_block(*ags, &b)
60:       collected[:any_block_args] = ags.first.is_a?(Symbol) and args.first == :any
61:       collected[:block_args] = ags
62:       collected[:block_callback] = b unless b.nil?
63:       self
64:     end
raise(*args) click to toggle source
    # File lib/caricature/expectation.rb, line 68
68:     def raise(*args)
69:       collected[:error_args] = args
70:       self
71:     end
Also aliased as: actual_raise
return(value=nil, &b) click to toggle source

tell the expectation it nees to return this value or the value returned by the block you provide to this method.

    # File lib/caricature/expectation.rb, line 51
51:     def return(value=nil, &b)
52:       collected[:return_value] = value
53:       collected[:return_callback] = b if b
54:       self
55:     end
Also aliased as: returns
returns(value=nil, &b) click to toggle source
Alias for: return
super_after(&b) click to toggle source

tell the expectation it needs to call the super after the expecation execution

    # File lib/caricature/expectation.rb, line 81
81:     def super_after(&b)
82:       collected[:super] = :after
83:       collected[:block] = b if b
84:       self
85:     end
super_before(&b) click to toggle source

tell the expecation it needs to call the super before the expectation exectution

    # File lib/caricature/expectation.rb, line 74
74:     def super_before(&b)
75:       collected[:super] = :before
76:       collected[:block] = b if b
77:       self
78:     end
with(*ags, &b) click to toggle source

tell the expection which arguments it needs to respond to there is a magic argument here any which configures the expectation to respond to any arguments

    # File lib/caricature/expectation.rb, line 42
42:     def with(*ags, &b)
43:       collected[:any_args] = ags.first.is_a?(Symbol) and ags.first == :any
44:       collected[:args] = ags   
45:       collected[:callback] = b unless b.nil?
46:       self
47:     end

Private Instance Methods

collected() click to toggle source
    # File lib/caricature/expectation.rb, line 96
96:       def collected
97:         @collected ||= {}
98:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.