aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonak Jangir <ronakjangir47@gmail.com>2015-09-19 18:35:41 +0530
committerRonak Jangir <ronakjangir47@gmail.com>2015-09-19 18:35:41 +0530
commitefa019b49c4ddf402752bcaed5e076f4ec0e335e (patch)
tree24d83304e00ee3e1e43726ac2e1a8b6ff0c86f56
parent2e7415bf71b017180d92ac6fdcafe215cc9eddb6 (diff)
downloadrails-efa019b49c4ddf402752bcaed5e076f4ec0e335e.tar.gz
rails-efa019b49c4ddf402752bcaed5e076f4ec0e335e.tar.bz2
rails-efa019b49c4ddf402752bcaed5e076f4ec0e335e.zip
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