aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Daer <jeremydaer@gmail.com>2015-09-19 15:43:47 -0700
committerJeremy Daer <jeremydaer@gmail.com>2015-09-19 15:43:47 -0700
commita6f461c312980607f215ee56e3c49aba54a726ea (patch)
tree2b8a25947f6538b04cd56065d3cc622b6288432c
parent377a9c37f6918b171f7a60293bb585ae891543b4 (diff)
parentefa019b49c4ddf402752bcaed5e076f4ec0e335e (diff)
downloadrails-a6f461c312980607f215ee56e3c49aba54a726ea.tar.gz
rails-a6f461c312980607f215ee56e3c49aba54a726ea.tar.bz2
rails-a6f461c312980607f215ee56e3c49aba54a726ea.zip
Merge pull request #21677 from ronakjangir47/send_file_headers_test
Added test for `send_file_headers` called with nil content type
-rw-r--r--actionpack/test/controller/send_file_test.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/actionpack/test/controller/send_file_test.rb b/actionpack/test/controller/send_file_test.rb
index c0ddcf7f50..fb9883fb18 100644
--- a/actionpack/test/controller/send_file_test.rb
+++ b/actionpack/test/controller/send_file_test.rb
@@ -143,7 +143,18 @@ class SendFileTest < ActionController::TestCase
}
@controller.headers = {}
- assert_raise(ArgumentError) { @controller.send(:send_file_headers!, options) }
+ error = assert_raise(ArgumentError) { @controller.send(:send_file_headers!, options) }
+ assert_equal "Unknown MIME type #{options[:type]}", error.message
+ end
+
+ def test_send_file_headers_with_nil_content_type
+ options = {
+ :type => nil
+ }
+
+ @controller.headers = {}
+ error = assert_raise(ArgumentError) { @controller.send(:send_file_headers!, options) }
+ assert_equal ":type option required", error.message
end
def test_send_file_headers_guess_type_from_extension