Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Delegate ActionDispatch::Http::UploadedFile#close to tempfile

  • Loading branch information...
commit dab08597417d55a1e9819781427aa2097ecdf2fb 1 parent 2068d30
@porras porras authored
View
2  actionpack/lib/action_dispatch/http/upload.rb
@@ -17,7 +17,7 @@ def read(*args)
end
# Delegate these methods to the tempfile.
- [:open, :path, :rewind, :size, :eof?].each do |method|
+ [:open, :close, :path, :rewind, :size, :eof?].each do |method|
class_eval "def #{method}; @tempfile.#{method}; end"
end
View
6 actionpack/test/dispatch/uploaded_file_test.rb
@@ -45,6 +45,12 @@ def test_delegates_open_to_tempfile
assert_equal 'thunderhorse', uf.open
end
+ def test_delegates_close_to_tempfile
+ tf = Class.new { def close; 'thunderhorse' end }
+ uf = Http::UploadedFile.new(:tempfile => tf.new)
+ assert_equal 'thunderhorse', uf.close
+ end
+
def test_delegates_to_tempfile
tf = Class.new { def read; 'thunderhorse' end }
uf = Http::UploadedFile.new(:tempfile => tf.new)
Please sign in to comment.
Something went wrong with that request. Please try again.