def flush
http = Net::HTTP.new @url.host, @url.port
http.use_ssl = @url.scheme == "https"
- resp, data = http.post(@url.request_uri, @outbuf, @headers)
+ resp = http.post(@url.request_uri, @outbuf, @headers)
+ data = resp.body
@inbuf = StringIO.new data
@outbuf = ""
end
Net::HTTP.should_receive(:new).with("my.domain.com", 80).and_return do
mock("Net::HTTP").tee do |http|
http.should_receive(:use_ssl=).with(false)
- http.should_receive(:post).with("/path/to/service?param=value", "a test frame", {"Content-Type"=>"application/x-thrift"}).and_return([nil, "data"])
+ http.should_receive(:post).with("/path/to/service?param=value", "a test frame", {"Content-Type"=>"application/x-thrift"}).and_return do
+ mock("Net::HTTPOK").tee do |response|
+ response.should_receive(:body).and_return "data"
+ end
+ end
end
end
@client.flush
Net::HTTP.should_receive(:new).with("my.domain.com", 80).and_return do
mock("Net::HTTP").tee do |http|
http.should_receive(:use_ssl=).with(false)
- http.should_receive(:post).with("/path/to/service?param=value", "test", headers).and_return([nil, "data"])
+ http.should_receive(:post).with("/path/to/service?param=value", "test", headers).and_return do
+ mock("Net::HTTPOK").tee do |response|
+ response.should_receive(:body).and_return "data"
+ end
+ end
end
end
@client.flush