Webmock rspec total_time

38 views
Skip to first unread message

ethicalhack3r

unread,
Jan 30, 2014, 8:54:56 AM1/30/14
to typh...@googlegroups.com
Hi,

I'm wanting to stub a request with webmock that takes 10 seconds to respond, however, response.total_time keeps returning nil when stubbing the request with webmock.

Here's the webmock stub:

stub_request(:any, 'http://www.example.com/').to_return(:status => 200, :time => 11)

And then:

response.total_time.nil? # true

I'm not sure where I got the "time" to_return parameter from in the first place, it doesn't seem to be working anyway.

Does anyone know how I can make webmock work with response.total_time? I've searched webmock's documentation and some of the code and couldn't find anything.

Thanks in advance,
Ryan

Hans Hasselberg

unread,
Jan 31, 2014, 7:59:24 AM1/31/14
to typh...@googlegroups.com

Hey Ryan, 

this is a problem with the Typhoeus Webmock integration. As you can see here: https://github.com/bblimke/webmock/blob/master/lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb#L82..L101 none of the response informations are set. The problem is probably that 'webmock_response' doesn't track that either... 

Ryan Dewhurst

unread,
Jan 31, 2014, 2:33:15 PM1/31/14
to typh...@googlegroups.com
Hey Hans,

Thanks for the reply. I'll open a ticket with webmock when I get time and see if they may know of a solution/workaround and/or put in a feature request.

Thanks again,
Ryan


--
You received this message because you are subscribed to the Google Groups "Typhoeus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to typhoeus+u...@googlegroups.com.
To post to this group, send email to typh...@googlegroups.com.
Visit this group at http://groups.google.com/group/typhoeus.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages