Method: Typhoeus::Expectation#and_return

Defined in:
lib/typhoeus/expectation.rb

#and_return(response = nil, &block) ⇒ void

This method returns an undefined value.

Specify what should be returned, when this expectation is hit.

Examples:

Add response.

expectation.and_return(response)

Since:

  • 0.5.0



138
139
140
141
# File 'lib/typhoeus/expectation.rb', line 138

def and_return(response=nil, &block)
  new_response = (response.nil? ? block : response)
  responses.push(*new_response)
end