diff options
Diffstat (limited to 'spec/controllers/request_controller_spec.rb')
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index a543995f6..759ac5ea1 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -114,10 +114,19 @@ 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'] response.content_type.should == "text/plain" - response.should have_text(/Second hello/) + 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'] response.content_type.should == "text/plain" - response.should have_text(/First hello/) + response.should have_text(/First hello/) + end + + it "should treat attachments with unknown extensions as binary" do + ir = info_requests(:fancy_dog_request) + receive_incoming_mail('incoming-request-attachment-unknown-extension.email', ir.incoming_email) + + get :get_attachment, :incoming_message_id => ir.incoming_messages[1].id, :id => ir.id, :part => 2, :file_name => ['hello.qwglhm'] + response.content_type.should == "application/octet-stream" + response.should have_text(/an unusual sort of file/) end it "should not download attachments with wrong file name" do @@ -144,7 +153,7 @@ 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'] response.content_type.should == "text/plain" - response.should have_text(/xxxxxx hello/) + response.should have_text(/xxxxxx hello/) end it "should censor with rules on the user (rather than the request)" do @@ -161,7 +170,7 @@ 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'] response.content_type.should == "text/plain" - response.should have_text(/xxxxxx hello/) + response.should have_text(/xxxxxx hello/) end it "should censor attachment names" do @@ -254,11 +263,11 @@ describe RequestController, "when changing prominence of a request" do get :get_attachment, :incoming_message_id => ir.incoming_messages[1].id, :id => ir.id, :part => 2 response.content_type.should == "text/html" - response.should_not have_text(/Second hello/) + response.should_not have_text(/Second hello/) response.should render_template('request/hidden') get :get_attachment, :incoming_message_id => ir.incoming_messages[1].id, :id => ir.id, :part => 3 response.content_type.should == "text/html" - response.should_not have_text(/First hello/) + response.should_not have_text(/First hello/) response.should render_template('request/hidden') end |