Explorar o código

prevent stringio error from opening small files

Nitay Joffe %!s(int64=11) %!d(string=hai) anos
pai
achega
0564571bae
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      lib/tasks/docs.thor

+ 5 - 0
lib/tasks/docs.thor

@@ -1,3 +1,8 @@
+# Prevents this error: https://gist.github.com/nitay/0cbf5ccb2bc611f627e5
+# See also: http://stackoverflow.com/questions/694115/why-does-ruby-open-uris-open-return-a-stringio-in-my-unit-test-but-a-fileio-in
+OpenURI::Buffer.send :remove_const, 'StringMax' if OpenURI::Buffer.const_defined?('StringMax')
+OpenURI::Buffer.const_set 'StringMax', 0
+
 class DocsCLI < Thor
   include Thor::Actions