summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/attachments.yml4
-rw-r--r--test/functional/attachments_controller_test.rb11
-rw-r--r--test/integration/api_test/attachments_test.rb2
3 files changed, 13 insertions, 4 deletions
diff --git a/test/fixtures/attachments.yml b/test/fixtures/attachments.yml
index 9437ed102..6f56c0811 100644
--- a/test/fixtures/attachments.yml
+++ b/test/fixtures/attachments.yml
@@ -78,7 +78,7 @@ attachments_006:
filesize: 157
filename: archive.zip
author_id: 2
- content_type: application/octet-stream
+ content_type: application/zip
attachments_007:
created_on: 2006-07-19 21:07:27 +02:00
container_type: Issue
@@ -91,7 +91,7 @@ attachments_007:
filesize: 157
filename: archive.zip
author_id: 1
- content_type: application/octet-stream
+ content_type: application/zip
attachments_008:
created_on: 2006-07-19 21:07:27 +02:00
container_type: Project
diff --git a/test/functional/attachments_controller_test.rb b/test/functional/attachments_controller_test.rb
index efd537599..5174c8da1 100644
--- a/test/functional/attachments_controller_test.rb
+++ b/test/functional/attachments_controller_test.rb
@@ -192,7 +192,7 @@ class AttachmentsControllerTest < ActionController::TestCase
def test_show_other
get :show, :id => 6
assert_response :success
- assert_equal 'application/octet-stream', @response.content_type
+ assert_equal 'application/zip', @response.content_type
set_tmp_attachments_directory
end
@@ -262,6 +262,15 @@ class AttachmentsControllerTest < ActionController::TestCase
set_tmp_attachments_directory
end
+ def test_download_should_assign_better_content_type_than_application_octet_stream
+ Attachment.find(4).update! :content_type => "application/octet-stream"
+
+ get :download, :id => 4
+ assert_response :success
+ assert_equal 'text/x-ruby', @response.content_type
+ set_tmp_attachments_directory
+ end
+
def test_download_missing_file
get :download, :id => 2
assert_response 404
diff --git a/test/integration/api_test/attachments_test.rb b/test/integration/api_test/attachments_test.rb
index d4b483527..0f7e6ebdb 100644
--- a/test/integration/api_test/attachments_test.rb
+++ b/test/integration/api_test/attachments_test.rb
@@ -65,7 +65,7 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
test "GET /attachments/download/:id/:filename should return the attachment content" do
get '/attachments/download/7/archive.zip', {}, credentials('jsmith')
assert_response :success
- assert_equal 'application/octet-stream', @response.content_type
+ assert_equal 'application/zip', @response.content_type
set_tmp_attachments_directory
end