Permalink
Browse files

A test for support for the new Typhoeus streaming API.

  • Loading branch information...
1 parent 3010a29 commit 4c6a8213a3601cfef3618ace54697adf0981dd2b @spraints spraints committed Dec 5, 2013
Showing with 19 additions and 0 deletions.
  1. +19 −0 spec/acceptance/typhoeus/typhoeus_hydra_spec.rb
@@ -78,6 +78,25 @@
hydra.run
test.should == response_code
end
+
+ it "should call on_body with 2xx response" do
+ body = "on_body fired"
+ stub_request(:any, "example.com").to_return(:body => body)
+
+ test_body = nil
+ test_complete = nil
+ pending("This test requires a newer version of Typhoeus") unless @request.respond_to?(:on_body)
+ @request.on_body do |response, body|
+ test_body = body
+ end
+ @request.on_complete do |response|
+ test_complete = response.body
+ end
+ hydra.queue @request
+ hydra.run
+ test_body.should == body
+ test_complete.should == ""
+ end
end
end
end

0 comments on commit 4c6a821

Please sign in to comment.