fixes the suite for uploaded files

This commit is contained in:
Xavier Noria 2012-09-23 00:50:30 +02:00
parent 3b0da715c5
commit 133d42bc0f

@ -46,25 +46,25 @@ def test_delegates_open_to_tempfile
end
def test_delegates_close_to_tempfile
tf = Class.new { def close; 'thunderhorse' end }
tf = Class.new { def close(unlink_now=false); '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 }
tf = Class.new { def close(unlink_now=false); "thunderhorse: #{unlink_now}" 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 }
def test_delegates_read_to_tempfile
tf = Class.new { def read(length=nil, buffer=nil); 'thunderhorse' end }
uf = Http::UploadedFile.new(:tempfile => tf.new)
assert_equal 'thunderhorse', uf.read
end
def test_delegates_to_tempfile_with_params
tf = Class.new { def read *args; args end }
def test_delegates_read_to_tempfile_with_params
tf = Class.new { def read(length=nil, buffer=nil); [length, buffer] end }
uf = Http::UploadedFile.new(:tempfile => tf.new)
assert_equal %w{ thunder horse }, uf.read(*%w{ thunder horse })
end