Class: Caricature::ExpectationBuilder

Inherits:
Object
  • Object
show all
Includes:
ExpectationSyntax
Defined in:
lib/caricature/expectation.rb

Overview

Constructs the expecation object. Used as a boundary between the definition and usage of the expectation

Instance Method Summary collapse

Methods included from ExpectationSyntax

#actual_raise, #any_args?, #pass_block, #raise, #return, #super_after, #super_before, #with

Constructor Details

#initialize(method_name) ⇒ ExpectationBuilder

initialises a new instance of the expectation builder this builder is passed into the block to allow only certain operations in the block.



252
253
254
# File 'lib/caricature/expectation.rb', line 252

def initialize(method_name)
  @collected = { :method_name => method_name, :args => [], :any_args => true }
end

Instance Method Details

#buildObject

build up the expectation with the provided arguments



259
260
261
# File 'lib/caricature/expectation.rb', line 259

def build
  Expectation.new collected
end