aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/request_controller_spec.rb
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2012-02-15 09:45:20 +0000
committerSeb Bacon <seb.bacon@gmail.com>2012-02-15 09:45:20 +0000
commit506af7a640f63b17000ccfc5e1344bbc3039c913 (patch)
treea3091a30d7b905936b346197b8f5fce7fc3a8b95 /spec/controllers/request_controller_spec.rb
parentbd1dbfb1db2527e9977899f3be69e624c42249fb (diff)
Set a "Content-Disposition: attachment" header when downloading files. Closes #428
Diffstat (limited to 'spec/controllers/request_controller_spec.rb')
-rw-r--r--spec/controllers/request_controller_spec.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index ddcb621e9..db5592be1 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -222,7 +222,6 @@ describe RequestController, "when showing one request" do
get :get_attachment, :incoming_message_id => ir.incoming_messages[1].id, :id => ir.id, :part => 2, :file_name => ['hello.txt'], :skip_cache => 1
response.content_type.should == "text/plain"
response.should have_text(/Second hello/)
-
get :get_attachment, :incoming_message_id => ir.incoming_messages[1].id, :id => ir.id, :part => 3, :file_name => ['hello.txt'], :skip_cache => 1
response.content_type.should == "text/plain"
response.should have_text(/First hello/)
@@ -351,6 +350,15 @@ describe RequestController, "when showing one request" do
response.should have_text(/an unusual sort of file/)
end
+ it "should apply a content-disposition header" do
+ ir = info_requests(:fancy_dog_request)
+ receive_incoming_mail('incoming-request-attachment-unknown-extension.email', ir.incoming_email)
+ ir.reload
+ get :get_attachment, :incoming_message_id => ir.incoming_messages[1].id, :id => ir.id, :part => 2, :file_name => ['hello.qwglhm'], :skip_cache => 1
+ response.headers.should include("Content-Disposition")
+ response.headers["Content-Disposition"].should include('hello.qwglhm')
+ end
+
it "should not download attachments with wrong file name" do
ir = info_requests(:fancy_dog_request)
receive_incoming_mail('incoming-request-two-same-name.email', ir.incoming_email)