Sha256: 3542dcf3cebd24c3f50a342ec1267aa40b6cb0df8a06fdff0434d9d6b2736a2d

Contents?: true

Size: 890 Bytes

Versions: 1

Compression:

Stored size: 890 Bytes

Contents

module Typhoeus
  module Hydras

    # This module handles the blocked connection request mode on
    # the hydra side, where only stubbed requests
    # are allowed.
    # Connection blocking needs to be turned on:
    #   Typhoeus.configure do |config|
    #     config.block_connection = true
    #   end
    #
    # When trying to do real requests a NoStub error
    # is raised.
    module BlockConnection

      # Overrides queue in order to check before if block connection
      # is turned on. If thats the case a NoStub error is
      # raised.
      #
      # @example Queue the request.
      #   hydra.queue(request)
      #
      # @param [ Request ] request The request to enqueue.
      def queue(request)
        if Typhoeus::Config.block_connection
          raise Typhoeus::Errors::NoStub.new(request)
        else
          super
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
typhoeus-0.5.0.alpha lib/typhoeus/hydras/block_connection.rb