display images from the file yard

This commit is contained in:
Alexey Verkhovsky 2005-01-23 03:52:07 +00:00
parent d6fe54f4ad
commit 39f854a11e
2 changed files with 33 additions and 6 deletions

View file

@ -29,7 +29,7 @@ class FileControllerTest < Test::Unit::TestCase
end
def test_file_download_text_file
File.open(FILE_AREA + '/foo.txt', 'wb') { |f| f.write "aaa\nbbb\n" }
File.open("#{FILE_AREA}/foo.txt", 'wb') { |f| f.write "aaa\nbbb\n" }
r = process 'file', 'web' => 'wiki1', 'id' => 'foo.txt'
@ -39,7 +39,7 @@ class FileControllerTest < Test::Unit::TestCase
end
def test_file_download_pdf_file
File.open(FILE_AREA + '/foo.pdf', 'wb') { |f| f.write "aaa\nbbb\n" }
File.open("#{FILE_AREA}/foo.pdf", 'wb') { |f| f.write "aaa\nbbb\n" }
r = process 'file', 'web' => 'wiki1', 'id' => 'foo.pdf'
@ -48,4 +48,13 @@ class FileControllerTest < Test::Unit::TestCase
assert_equal 'application/pdf', r.headers['Content-Type']
end
def test_pic_download_gif
FileUtils.cp("#{RAILS_ROOT}/test/fixtures/rails.gif", FILE_AREA)
r = process 'pic', 'web' => 'wiki1', 'id' => 'rails.gif'
assert_success
assert_equal File.size("#{FILE_AREA}/rails.gif"), r.binary_content.size
end
end