summaryrefslogtreecommitdiff
path: root/lib/rb/spec/http_client_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rb/spec/http_client_spec.rb')
-rw-r--r--lib/rb/spec/http_client_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/rb/spec/http_client_spec.rb b/lib/rb/spec/http_client_spec.rb
index 793fc73ab..5e8da24b2 100644
--- a/lib/rb/spec/http_client_spec.rb
+++ b/lib/rb/spec/http_client_spec.rb
@@ -67,6 +67,21 @@ describe 'Thrift::HTTPClientTransport' do
end
@client.flush
end
+
+ it 'should reset the outbuf on HTTP failures' do
+ @client.write "test"
+
+ Net::HTTP.should_receive(:new).with("my.domain.com", 80).and_return do
+ mock("Net::HTTP").tap do |http|
+ http.should_receive(:use_ssl=).with(false)
+ http.should_receive(:post).with("/path/to/service?param=value", "test", {"Content-Type"=>"application/x-thrift"}) { raise Net::ReadTimeout }
+ end
+ end
+
+ @client.flush rescue
+ @client.instance_variable_get(:@outbuf).should eq(Thrift::Bytes.empty_byte_buffer)
+ end
+
end
describe 'ssl enabled' do