module Excon
def stub(request_params, response_params = nil)
-
response
(Hash
) -- params to return from matched request or block to call with params -
request
(Hash
) -- params to match against, omitted params match all
def stub(request_params, response_params = nil) if block_given? if response_params raise(ArgumentError.new("stub requires either response_params OR a block")) else stub = [request_params, Proc.new] end elsif response_params stub = [request_params, response_params] else raise(ArgumentError.new("stub requires either response_params OR a block")) end stubs << stub stub end