test/test_fake_web.rb in chrisk-fakeweb-1.2.0 vs test/test_fake_web.rb in chrisk-fakeweb-1.2.1
- old
+ new
@@ -484,6 +484,17 @@
end
def test_requiring_fakeweb_instead_of_fake_web
require "fakeweb"
end
+
+ def test_registering_using_response_with_string_containing_null_byte
+ # Regression test for File.exists? raising an ArgumentError ("string
+ # contains null byte") since :response first tries to find by filename.
+ # The string should be treated as a response body, instead, and an
+ # EOFError is raised when the byte is encountered.
+ FakeWeb.register_uri("http://example.com", :response => "test\0test")
+ assert_raise EOFError do
+ Net::HTTP.get(URI.parse("http://example.com"))
+ end
+ end
end