Sha256: 884e5bfc5c3ce46f575ee7f84159f553302d938153988ad6dc1a32b7ad059edc

Contents?: true

Size: 725 Bytes

Versions: 6

Compression:

Stored size: 725 Bytes

Contents

module Typhoeus
  class Request

    # This module handles stubbing on the request side.
    # It plays well with the block_connection configuration,
    # which raises when you make a request which is not stubbed.
    #
    # @api private
    module Stubbable

      # Override run in order to check for matching expecations.
      # When an expecation is found, super is not called. Instead a
      # canned response is assigned to the request.
      #
      # @example Run the request.
      #   request.run
      #
      # @return [ Response ] The response.
      def run
        if response = Expectation.response_for(self)
          finish(response)
        else
          super
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
typhoeus-0.6.8 lib/typhoeus/request/stubbable.rb
typhoeus-0.6.7 lib/typhoeus/request/stubbable.rb
typhoeus-0.6.6 lib/typhoeus/request/stubbable.rb
typhoeus-0.6.5 lib/typhoeus/request/stubbable.rb
typhoeus-0.6.4 lib/typhoeus/request/stubbable.rb
typhoeus-0.6.3 lib/typhoeus/request/stubbable.rb