mirror of
https://github.com/redmine/redmine.git
synced 2025-11-08 22:36:02 +01:00
code clean up test/integration/issues_test.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@18620 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -103,15 +103,16 @@ class IssuesTest < Redmine::IntegrationTest
|
|||||||
def test_issue_attachments
|
def test_issue_attachments
|
||||||
log_user('jsmith', 'jsmith')
|
log_user('jsmith', 'jsmith')
|
||||||
set_tmp_attachments_directory
|
set_tmp_attachments_directory
|
||||||
|
|
||||||
attachment = new_record(Attachment) do
|
attachment = new_record(Attachment) do
|
||||||
put '/issues/1', :params => {
|
put '/issues/1', :params => {
|
||||||
:issue => {:notes => 'Some notes'},
|
:issue => {:notes => 'Some notes'},
|
||||||
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'This is an attachment'}}
|
:attachments => {
|
||||||
|
'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'),
|
||||||
|
'description' => 'This is an attachment'}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
assert_redirected_to "/issues/1"
|
assert_redirected_to "/issues/1"
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_equal Issue.find(1), attachment.container
|
assert_equal Issue.find(1), attachment.container
|
||||||
assert_equal 'testfile.txt', attachment.filename
|
assert_equal 'testfile.txt', attachment.filename
|
||||||
assert_equal 'This is an attachment', attachment.description
|
assert_equal 'This is an attachment', attachment.description
|
||||||
@@ -119,7 +120,6 @@ class IssuesTest < Redmine::IntegrationTest
|
|||||||
assert_equal 59, attachment.filesize
|
assert_equal 59, attachment.filesize
|
||||||
# verify that the attachment was written to disk
|
# verify that the attachment was written to disk
|
||||||
assert File.exist?(attachment.diskfile)
|
assert File.exist?(attachment.diskfile)
|
||||||
|
|
||||||
# remove the attachments
|
# remove the attachments
|
||||||
Issue.find(1).attachments.each(&:destroy)
|
Issue.find(1).attachments.each(&:destroy)
|
||||||
assert_equal 0, Issue.find(1).attachments.length
|
assert_equal 0, Issue.find(1).attachments.length
|
||||||
|
|||||||
Reference in New Issue
Block a user