Add tests for x-sendfile, <audio> and <video> support.
This commit is contained in:
Jacques Distler 2009-03-03 22:27:26 -06:00
parent c7418af48d
commit d8a2a3657d
3 changed files with 43 additions and 0 deletions

View file

@ -81,6 +81,18 @@ class FileControllerTest < ActionController::TestCase
assert_equal 'inline; filename="rails.gif"', r.headers['Content-Disposition']
end
def test_pic_x_sendfile
pic = File.open("#{RAILS_ROOT}/test/fixtures/rails.gif", 'rb') { |f| f.read }
@web.wiki_files.create(:file_name => 'rails.gif', :description => 'An image', :content => pic)
@request.env.update({ 'HTTP_X_SENDFILE_TYPE' => 'foo' })
r = get :file, :web => 'wiki1', :id => 'rails.gif'
assert_response(:success, bypass_body_parsing = true)
assert_match '/rails.gif', r.headers['X-Sendfile']
assert_equal 'image/gif', r.headers['Content-Type']
assert_equal 'inline; filename="rails.gif"', r.headers['Content-Disposition']
end
def test_pic_unknown_pic
r = get :file, :web => 'wiki1', :id => 'non-existant.gif'