Sha256: db359cc10a428dc9980ccafccce507b607ce51bc72d61b9b1b9d56e0a01a3429

Contents?: true

Size: 835 Bytes

Versions: 6846

Compression:

Stored size: 835 Bytes

Contents

module Typhoeus
  class Hydra

    # This module handles stubbing on the hydra 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 add 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 Add the request.
      #   hydra.add(request)
      def add(request)
        if response = Expectation.response_for(request)
          request.execute_headers_callbacks(response)
          request.on_body.each{ |callback| callback.call(response.body, response) }
          request.finish(response)
        else
          super
        end
      end
    end
  end
end

Version data entries

6,846 entries across 6,843 versions & 28 rubygems

Version Path
cloudsmith-api-0.54.15 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
cloudsmith-api-0.53.79 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
cloudsmith-api-0.53.17 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
cloudsmith-api-0.53.3 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
cloudsmith-api-0.53.1 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
cloudsmith-api-0.52.121 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
cloudsmith-api-0.52.92 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
cloudsmith-api-0.52.79 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
cloudsmith-api-0.52.5 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
cloudsmith-api-0.52.0 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
cloudsmith-api-0.51.93 vendor/bundle/ruby/2.3.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
cloudsmith-api-0.51.38 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
cloudsmith-api-0.51.37 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
cloudsmith-api-0.51.34 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
cloudsmith-api-0.51.22 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
typhoeus-1.4.0 lib/typhoeus/hydra/stubbable.rb
talon_one-2.0.0 vendor/bundle/ruby/2.3.0/gems/typhoeus-1.3.1/lib/typhoeus/hydra/stubbable.rb
talon_one-2.0.0 vendor/bundle/ruby/2.7.0/gems/typhoeus-1.3.1/lib/typhoeus/hydra/stubbable.rb
cloudsmith-api-0.49.118 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.3.1/lib/typhoeus/hydra/stubbable.rb
cloudsmith-api-0.49.98 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.3.1/lib/typhoeus/hydra/stubbable.rb