Added test for when an attachment fails to save.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3527 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
f6d8752e44
commit
44955a519c
|
@ -809,6 +809,26 @@ class IssuesControllerTest < ActionController::TestCase
|
||||||
assert mail.body.include?('testfile.txt')
|
assert mail.body.include?('testfile.txt')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_put_update_with_attachment_that_fails_to_save
|
||||||
|
set_tmp_attachments_directory
|
||||||
|
|
||||||
|
# Delete all fixtured journals, a race condition can occur causing the wrong
|
||||||
|
# journal to get fetched in the next find.
|
||||||
|
Journal.delete_all
|
||||||
|
|
||||||
|
# Mock out the unsaved attachment
|
||||||
|
Attachment.any_instance.stubs(:create).returns(Attachment.new)
|
||||||
|
|
||||||
|
# anonymous user
|
||||||
|
put :update,
|
||||||
|
:id => 1,
|
||||||
|
:notes => '',
|
||||||
|
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
|
||||||
|
assert_redirected_to :action => 'show', :id => '1'
|
||||||
|
assert_equal '1 file(s) could not be saved.', flash[:warning]
|
||||||
|
|
||||||
|
end if Object.const_defined?(:Mocha)
|
||||||
|
|
||||||
def test_put_update_with_no_change
|
def test_put_update_with_no_change
|
||||||
issue = Issue.find(1)
|
issue = Issue.find(1)
|
||||||
issue.journals.clear
|
issue.journals.clear
|
||||||
|
|
Loading…
Reference in New Issue