aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/send_file_test.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2008-12-26 17:18:06 +0000
committerPratik Naik <pratiknaik@gmail.com>2008-12-26 17:18:06 +0000
commit73e9f4e9096515e9f4d97baaa914320c42159985 (patch)
treedb8fc9b9c07ca9a523a764ad76ce3b75254c73b3 /actionpack/test/controller/send_file_test.rb
parent2cd8d3b4c5b2a90da52bfe2e92455fdecfb89ac2 (diff)
parent07298fd0929ae1c6dd6d1b41bf320112d6bfc6a0 (diff)
downloadrails-73e9f4e9096515e9f4d97baaa914320c42159985.tar.gz
rails-73e9f4e9096515e9f4d97baaa914320c42159985.tar.bz2
rails-73e9f4e9096515e9f4d97baaa914320c42159985.zip
Merge commit 'mainstream/master'
Diffstat (limited to 'actionpack/test/controller/send_file_test.rb')
-rw-r--r--actionpack/test/controller/send_file_test.rb29
1 files changed, 27 insertions, 2 deletions
diff --git a/actionpack/test/controller/send_file_test.rb b/actionpack/test/controller/send_file_test.rb
index ffbaa457f8..1b7486ad34 100644
--- a/actionpack/test/controller/send_file_test.rb
+++ b/actionpack/test/controller/send_file_test.rb
@@ -119,17 +119,42 @@ class SendFileTest < Test::Unit::TestCase
assert_equal 'private', h['Cache-Control']
end
+ def test_send_file_headers_with_mime_lookup_with_symbol
+ options = {
+ :length => 1,
+ :type => :png
+ }
+
+ @controller.headers = {}
+ @controller.send(:send_file_headers!, options)
+
+ headers = @controller.headers
+
+ assert_equal 'image/png', headers['Content-Type']
+ end
+
+
+ def test_send_file_headers_with_bad_symbol
+ options = {
+ :length => 1,
+ :type => :this_type_is_not_registered
+ }
+
+ @controller.headers = {}
+ assert_raises(ArgumentError){ @controller.send(:send_file_headers!, options) }
+ 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 Internal Server Error', @response.headers['Status']
+ assert_equal '500 Internal Server Error', @response.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, @response.headers['Status']
+ assert_equal ActionController::Base::DEFAULT_RENDER_STATUS_CODE, @response.status
end
end
end