Re: [fakeweb] requiring FakeWeb breaks Net::HTTP.get?

29 views
Skip to first unread message
Message has been deleted

Chris Kampmeier

unread,
Jan 30, 2009, 2:40:57 PM1/30/09
to fakewe...@googlegroups.com
On Jan 30, 2009, at 1:21 AM, logan wrote:

>
> I'm experiencing a weird issue with Fakeweb. This is with Ruby 1.8.7
> on Mac OSX's latest incarnation.
>
> this code:
>
> #require 'fake_web'
>
> def test_image_check
> url = URI.parse("http://images.scripting.com/archiveScriptingCom/
> 2009/01/23/obamasOnTV.jpg")
> http = Net::HTTP.new(url.host, url.port)
> http.read_timeout = 2
> http.open_timeout = 2
> resp = http.start() {|http| http.get(url.path) }
> return resp.code, resp.body
> rescue Timeout::Error
> return nil, nil
> rescue Exception
> puts "Error: #{$!}"
> end
>
> works fine - the image is downloaded, returned. Note in the above
> case I've commented out the FakeWeb require. Now remove the pound
> sign in front of the require, and rerun the test. Test catches
> Interrupted system call error - every time its run. Now obviously if
> I had defined some behavior by calling register_uri that would be one
> thing, but I've done nothing but the require.
>
> Any ideas?

Hi Logan,

I actually fixed a very similar-sounding issue in my fork on GitHub. I
was noticing it with an older version of Ruby I encountered, 1.8.6 p36.

Are you using one of the forks from GitHub, like chrisk-fakeweb? Or
just the fakeweb gem from rubyforge?

If you can tell me both the name and version of the fakeweb gem you're
using, as well as the exact Ruby version (e.g. with `ruby -v`), I'll
try to duplicate the issue here.

Thanks-
Chris

logan

unread,
Mar 5, 2009, 2:45:45 AM3/5/09
to FakeWeb
Chris

Thanks for your reply - in the interim I discovered your version of
fakeweb on github and it resolved the error I posted about. There are
other problems I've discovered, but I'll leave that for another time
since I really don't understand their root cause yet.

On Jan 30, 11:40 am, Chris Kampmeier <chrisgkampme...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages