so I found that best place to stub is here https://github.com/sferik/twitter/blob/master/lib/twitter/streaming/connection.rb#L21
first record your stream by first temporarily monkeypatching SSLSocket#readpartial
in your spec file running one spec
module OpenSSL::SSL
class SSLSocket
F = File.open("fixtures/twitter/stream0.txt","w")
def readpartial(*args)
res = super(*args)
F.write res
F.flush
res
end
end
end
when your fixture is done. you can stub like:
OpenSSL::SSL::SSLSocket.any_instance.should_receive(:readpartial).with(1024).and_return(File.read("fixtures/twitter/stream0.txt")