diff options
Diffstat (limited to 'test/test_fresh.rb')
-rw-r--r-- | test/test_fresh.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test_fresh.rb b/test/test_fresh.rb index b619a6a..706783e 100644 --- a/test/test_fresh.rb +++ b/test/test_fresh.rb @@ -147,4 +147,22 @@ class TestMogFresh < Test::Unit::TestCase end src.close! end + + def test_new_file_copy_stream_known_length + add_host_device_domain + opts = { :content_length => 666 } + input = StringIO.new("short") + client = MogileFS::MogileFS.new :hosts => @hosts, :domain => @domain + assert_raises(MogileFS::SizeMismatchError) do + client.new_file("copy_stream", opts) do |io| + IO.copy_stream(input, io) + end + end + + assert_raises(MogileFS::SizeMismatchError) do + client.new_file("copy_stream", opts) do |io| + IO.copy_stream(input, io, 666) + end + end + end if IO.respond_to?(:copy_stream) end |