diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-01-11 22:07:04 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-01-11 22:07:04 +0000 |
commit | 9889d86a6ce1c2206460276e63d7c0317b41a72f (patch) | |
tree | f5fe6c4f17bebf0355dc0b5174df3af6979d3ea2 /actionpack/test | |
parent | ebfd03b938d2cb996bc5786768e339b7221a724d (diff) | |
download | rails-9889d86a6ce1c2206460276e63d7c0317b41a72f.tar.gz rails-9889d86a6ce1c2206460276e63d7c0317b41a72f.tar.bz2 rails-9889d86a6ce1c2206460276e63d7c0317b41a72f.zip |
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
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/send_file_test.rb | 15 |
1 files changed, 13 insertions, 2 deletions
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') } |