aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2012-09-22 13:52:19 -0700
committerXavier Noria <fxn@hashref.com>2012-09-22 13:52:19 -0700
commit40b57116975cafdd9f81a49a7bc757809f4465f8 (patch)
tree28b376888bdd02b290042bdfc8ff5212768425d9 /actionpack/test
parent19fa8fa3c436ed5b25e7ed0005f128487a7d1f0b (diff)
parente9ba548baf74cc3a5ec65135dac385d81e14f06e (diff)
downloadrails-40b57116975cafdd9f81a49a7bc757809f4465f8.tar.gz
rails-40b57116975cafdd9f81a49a7bc757809f4465f8.tar.bz2
rails-40b57116975cafdd9f81a49a7bc757809f4465f8.zip
Merge pull request #7713 from porras/action-dispatch-upload-delegates-close-to-tempfile
Delegate ActionDispatch::Http::UploadedFile#close to tempfile
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/dispatch/uploaded_file_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/uploaded_file_test.rb b/actionpack/test/dispatch/uploaded_file_test.rb
index e69c1fbed4..f72afe745c 100644
--- a/actionpack/test/dispatch/uploaded_file_test.rb
+++ b/actionpack/test/dispatch/uploaded_file_test.rb
@@ -45,6 +45,18 @@ module ActionDispatch
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_close_accepts_parameter
+ tf = Class.new { def close(optional = false); "thunderhorse: #{optional}" end }
+ uf = Http::UploadedFile.new(:tempfile => tf.new)
+ assert_equal 'thunderhorse: true', uf.close(true)
+ end
+
def test_delegates_to_tempfile
tf = Class.new { def read; 'thunderhorse' end }
uf = Http::UploadedFile.new(:tempfile => tf.new)