Sha256: e557b26d602aea60378a3fd535431a92118dd75a74692354c4255ae309b9a09e

Contents?: true

Size: 677 Bytes

Versions: 25

Compression:

Stored size: 677 Bytes

Contents

module Net
  remove_const "HTTP"
  class Request < Struct.new(:host, :port, :query, :post_data, :headers)
    def post(query, post, headers = {})
      self.query = query
      self.post_data = post
      self.headers = headers
    end
  end

  class Net::HTTP
    def initialize(*args)
    end

    def self.start(host, port)
      request = Request.new
      request.host = host
      request.port = port

      @pings ||= []
      @pings << request

      yield request

    end

    def self.pings
      @pings
    end

    def self.next_response=(mock_response)
      @@response = mock_response
    end

    def self.get_response(*args)
      @@response
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
typo-5.4.4 test/mocks/test/http_mock.rb
typo-5.4.3 test/mocks/test/http_mock.rb
typo-5.4.2 test/mocks/test/http_mock.rb
typo-5.4.1 test/mocks/test/http_mock.rb
typo-5.4 test/mocks/test/http_mock.rb
typo-3.99.4 test/mocks/test/http_mock.rb
typo-4.0.0 test/mocks/test/http_mock.rb
typo-4.0.2 test/mocks/test/http_mock.rb
typo-4.0.1 test/mocks/test/http_mock.rb
typo-4.0.3 test/mocks/test/http_mock.rb
typo-4.1.1 test/mocks/test/http_mock.rb
typo-5.0.2 test/mocks/test/http_mock.rb
typo-4.1 test/mocks/test/http_mock.rb
typo-5.0.1 test/mocks/test/http_mock.rb
typo-5.0.3.98.1 test/mocks/test/http_mock.rb
typo-5.0 test/mocks/test/http_mock.rb
typo-5.0.3.98 test/mocks/test/http_mock.rb
typo-5.1.1 test/mocks/test/http_mock.rb
typo-5.1.2 test/mocks/test/http_mock.rb
typo-5.1.3 test/mocks/test/http_mock.rb