module Typhoeus

def self.stub(base_url, options = {}, &block)

Other tags:
    See: Typhoeus::Expectation -

Returns:
  • (Typhoeus::Expectation) - The expecatation.

Parameters:
  • options (Hash) -- The options to stub out.
  • base_url (String) -- The url to stub out.

Other tags:
    Example: -
def self.stub(base_url, options = {}, &block)
  expectation = Expectation.all.find{ |e| e.base_url == base_url && e.options == options }
  if expectation.nil?
    expectation = Expectation.new(base_url, options)
    Expectation.all << expectation
  end
  expectation.and_return(&block) unless block.nil?
  expectation
end