Sha256: 93eff74a1fd8c2d2a75af3313c34b77a5998af904e8d5cddfe5d77a91581dcfa
Contents?: true
Size: 729 Bytes
Versions: 16
Compression:
Stored size: 729 Bytes
Contents
shared_examples_for 'a streaming client' do |endpoint, timeout| ret = [] timing = 'response times ok' start = Time.now block = lambda do |c,r,t| # add the response ret.push(c) # check if the timing is ok # each response arrives after timeout and before timeout + 1 cur_time = Time.now - start if cur_time < ret.length * timeout or cur_time > (ret.length+1) * timeout timing = 'response time not ok!' end end it "gets a response in less than or equal to #{(timeout*3).round(2)} seconds" do Excon.get(endpoint, :response_block => block) # validate the final timing expect((Time.now - start <= timeout*3) == true && timing == 'response times not ok!').to be false end end
Version data entries
16 entries across 14 versions & 2 rubygems