diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-06-02 00:51:56 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-06-02 00:51:56 +0000 |
commit | ac66cf1289a18504668baffeb1808540103ddc7a (patch) | |
tree | 404a296d35ce4981ab047c0b3ae12a94bff2df95 /actionpack/test/controller | |
parent | 9e7e89a5611d7c798018c318b612a5ba046d8947 (diff) | |
download | rails-ac66cf1289a18504668baffeb1808540103ddc7a.tar.gz rails-ac66cf1289a18504668baffeb1808540103ddc7a.tar.bz2 rails-ac66cf1289a18504668baffeb1808540103ddc7a.zip |
Add :status option to send_data and send_file. Defaults to '200 OK'. Closes #5243.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4400 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/send_file_test.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/actionpack/test/controller/send_file_test.rb b/actionpack/test/controller/send_file_test.rb index 683d6eba60..4c97e2d5d2 100644 --- a/actionpack/test/controller/send_file_test.rb +++ b/actionpack/test/controller/send_file_test.rb @@ -85,11 +85,25 @@ class SendFileTest < Test::Unit::TestCase assert_equal 'type', h['Content-Type'] assert_equal 'disposition; filename="filename"', h['Content-Disposition'] assert_equal 'binary', h['Content-Transfer-Encoding'] - + # test overriding Cache-Control: no-cache header to fix IE open/save dialog @controller.headers = { 'Cache-Control' => 'no-cache' } @controller.send(:send_file_headers!, options) h = @controller.headers assert_equal 'private', h['Cache-Control'] end + + %w(file data).each do |method| + define_method "test_send_#{method}_status" do + @controller.options = { :stream => false, :status => 500 } + assert_nothing_raised { assert_not_nil process(method) } + assert_equal '500', @controller.headers['Status'] + end + + define_method "test_default_send_#{method}_status" do + @controller.options = { :stream => false } + assert_nothing_raised { assert_not_nil process(method) } + assert_equal ActionController::Base::DEFAULT_RENDER_STATUS_CODE, @controller.headers['Status'] + end + end end |