From 9889d86a6ce1c2206460276e63d7c0317b41a72f Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 11 Jan 2008 22:07:04 +0000 Subject: Introduce send_file :x_sendfile => true to send an X-Sendfile response header. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8628 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/controller/send_file_test.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'actionpack/test/controller') diff --git a/actionpack/test/controller/send_file_test.rb b/actionpack/test/controller/send_file_test.rb index 8fa700d387..406825fe59 100644 --- a/actionpack/test/controller/send_file_test.rb +++ b/actionpack/test/controller/send_file_test.rb @@ -27,7 +27,7 @@ class SendFileTest < Test::Unit::TestCase include TestFileUtils Mime::Type.register "image/png", :png unless defined? Mime::PNG - + def setup @controller = SendFileController.new @request = ActionController::TestRequest.new @@ -55,7 +55,7 @@ class SendFileTest < Test::Unit::TestCase assert_nothing_raised { response.body.call(response, output) } assert_equal file_data, output.string end - + def test_file_url_based_filename @controller.options = { :url_based_filename => true } response = nil @@ -64,6 +64,17 @@ class SendFileTest < Test::Unit::TestCase assert_equal "attachment", response.headers["Content-Disposition"] end + def test_x_sendfile_header + @controller.options = { :x_sendfile => true } + + response = nil + assert_nothing_raised { response = process('file') } + assert_not_nil response + + assert_equal @controller.file_path, response.headers['X-Sendfile'] + assert response.body.blank? + end + def test_data response = nil assert_nothing_raised { response = process('data') } -- cgit v1.2.3