chrisk/fakeweb

Pathname support when a filename is expected

chrisk opened this issue · 1 comments

$ irb -rubygems -rfakeweb -rpathname
>> FakeWeb.register_uri(:get, "http://example.com", :body => Pathname.new("/example.txt"))
=> [#<FakeWeb::Responder:0x10147ba38 @uri="http://example.com", @method=:get, @options={:body=>#<Pathname:/example.txt>}, @times=1>]
>> Net::HTTP.get(URI.parse("http://example.com"))
NoMethodError: undefined method `include?' for #<Pathname:/example.txt>
    from /Library/Ruby/Gems/1.8/gems/fakeweb-1.2.7/lib/fake_web/responder.rb:50:in `body'

This comes up a lot because Rails.root is a Pathname.

Support Pathname objects where a filename is expected

Closed by 925226c.