From 9daf39ec5242a6a87efb9c862952e176d4314856 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 29 Feb 2008 19:46:58 +0000 Subject: Adds an optional description to attachments. git-svn-id: http://redmine.rubyforge.org/svn/trunk@1180 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/functional/documents_controller_test.rb | 2 +- test/functional/issues_controller_test.rb | 2 +- test/integration/issues_test.rb | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/functional/documents_controller_test.rb b/test/functional/documents_controller_test.rb index 7ba308ec5..f150a5b7a 100644 --- a/test/functional/documents_controller_test.rb +++ b/test/functional/documents_controller_test.rb @@ -44,7 +44,7 @@ class DocumentsControllerTest < Test::Unit::TestCase :document => { :title => 'DocumentsControllerTest#test_post_new', :description => 'This is a new document', :category_id => 2}, - :attachments => [ ActionController::TestUploadedFile.new(Test::Unit::TestCase.fixture_path + '/files/testfile.txt', 'text/plain') ] + :attachments => {'1' => {'file' => test_uploaded_file('testfile.txt', 'text/plain')}} assert_redirected_to 'projects/ecookbook/documents' diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 4f28ab224..34b030d98 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -300,7 +300,7 @@ class IssuesControllerTest < Test::Unit::TestCase post :edit, :id => 1, :notes => '', - :attachments => [ test_uploaded_file('testfile.txt', 'text/plain') ] + :attachments => {'1' => {'file' => test_uploaded_file('testfile.txt', 'text/plain')}} assert_redirected_to 'issues/show/1' j = Issue.find(1).journals.find(:first, :order => 'id DESC') assert j.notes.blank? diff --git a/test/integration/issues_test.rb b/test/integration/issues_test.rb index eda4ef676..facd7c630 100644 --- a/test/integration/issues_test.rb +++ b/test/integration/issues_test.rb @@ -50,13 +50,14 @@ class IssuesTest < ActionController::IntegrationTest post 'issues/edit/1', :notes => 'Some notes', - :attachments => ([] << ActionController::TestUploadedFile.new(Test::Unit::TestCase.fixture_path + '/files/testfile.txt', 'text/plain')) + :attachments => {'1' => {'file' => test_uploaded_file('testfile.txt', 'text/plain'), 'description' => 'This is an attachment'}} assert_redirected_to "issues/show/1" # make sure attachment was saved attachment = Issue.find(1).attachments.find_by_filename("testfile.txt") assert_kind_of Attachment, attachment assert_equal Issue.find(1), attachment.container + assert_equal 'This is an attachment', attachment.description # verify the size of the attachment stored in db #assert_equal file_data_1.length, attachment.filesize # verify that the attachment was written to disk -- cgit v1.2.3