##// END OF EJS Templates
Added test for when an attachment fails to save....
Eric Davis -
r3413:44955a519c77
parent child
Show More
@@ -808,7 +808,27 class IssuesControllerTest < ActionController::TestCase
808 mail = ActionMailer::Base.deliveries.last
808 mail = ActionMailer::Base.deliveries.last
809 assert mail.body.include?('testfile.txt')
809 assert mail.body.include?('testfile.txt')
810 end
810 end
811
811
812 def test_put_update_with_attachment_that_fails_to_save
813 set_tmp_attachments_directory
814
815 # Delete all fixtured journals, a race condition can occur causing the wrong
816 # journal to get fetched in the next find.
817 Journal.delete_all
818
819 # Mock out the unsaved attachment
820 Attachment.any_instance.stubs(:create).returns(Attachment.new)
821
822 # anonymous user
823 put :update,
824 :id => 1,
825 :notes => '',
826 :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
827 assert_redirected_to :action => 'show', :id => '1'
828 assert_equal '1 file(s) could not be saved.', flash[:warning]
829
830 end if Object.const_defined?(:Mocha)
831
812 def test_put_update_with_no_change
832 def test_put_update_with_no_change
813 issue = Issue.find(1)
833 issue = Issue.find(1)
814 issue.journals.clear
834 issue.journals.clear
General Comments 0
You need to be logged in to leave comments. Login now