From 7e347069d5607a329de2bcfd77dbbb9c2e345630 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Thu, 23 Feb 2012 12:18:10 +0000 Subject: Better message for file size validation error. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8937 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/integration/api_test/attachments_test.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/integration/api_test') diff --git a/test/integration/api_test/attachments_test.rb b/test/integration/api_test/attachments_test.rb index 16fc531a3..5e20449d4 100644 --- a/test/integration/api_test/attachments_test.rb +++ b/test/integration/api_test/attachments_test.rb @@ -116,5 +116,16 @@ class ApiTest::AttachmentsTest < ActionController::IntegrationTest assert_response 406 end end + + should "return errors if file is too big" do + set_tmp_attachments_directory + with_settings :attachment_max_size => 1 do + assert_no_difference 'Attachment.count' do + post '/uploads.xml', ('x' * 2048), {'Content-Type' => 'application/octet-stream'}.merge(credentials('jsmith')) + assert_response 422 + assert_tag 'error', :content => /exceeds the maximum allowed file size/ + end + end + end end end -- cgit v1.2.3