Permalink
Browse files

Add spec for excon's streaming API.

  • Loading branch information...
1 parent 2659fd5 commit 00f50c26599c35a173fa2ee17e0adeacc7f6637d @myronmarston committed Jul 16, 2011
Showing with 20 additions and 0 deletions.
  1. +20 −0 spec/vcr/http_stubbing_adapters/excon_spec.rb
@@ -35,5 +35,25 @@
recorded.should == 'query: Tolkien'
end
end
+
+ context "when Excon's streaming API is used" do
+ it 'properly records and plays back the response' do
+ described_class.http_connections_allowed = true
+ recorded, played_back = [1, 2].map do
+ chunks = []
+
+ VCR.use_cassette('excon_streaming', :record => :once) do
+ Excon.get("http://localhost:#{VCR::SinatraApp.port}/foo") do |chunk, remaining_bytes, total_bytes|
+ chunks << chunk
+ end
+ end
+
+ chunks.join
+ end
+
+ recorded.should == played_back
+ recorded.should == "FOO!"
+ end
+ end
end

0 comments on commit 00f50c2

Please sign in to comment.