Fixes Issue#save_issue_with_child_records so that time entry do not get saved if issue save fails.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3664 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2010-04-11 16:48:46 +00:00
parent 43e5bb75d2
commit f35921d308
2 changed files with 42 additions and 38 deletions

View File

@@ -827,7 +827,7 @@ class IssuesControllerTest < ActionController::TestCase
put :update,
:id => 1,
:notes => '2.5 hours added',
:time_entry => { :hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first }
:time_entry => { :hours => '2.5', :comments => 'test_put_update_with_note_and_spent_time', :activity_id => TimeEntryActivity.first }
end
assert_redirected_to :action => 'show', :id => '1'
@@ -837,7 +837,7 @@ class IssuesControllerTest < ActionController::TestCase
assert_equal '2.5 hours added', j.notes
assert_equal 0, j.details.size
t = issue.time_entries.find(:first, :order => 'id DESC')
t = issue.time_entries.find_by_comments('test_put_update_with_note_and_spent_time')
assert_not_nil t
assert_equal 2.5, t.hours
assert_equal spent_hours_before + 2.5, issue.spent_hours
@@ -985,15 +985,18 @@ class IssuesControllerTest < ActionController::TestCase
@request.session[:user_id] = 2
assert_no_difference 'Journal.count' do
assert_no_difference 'Attachment.count' do
put :update,
:id => issue.id,
:issue => {
:fixed_version_id => 4,
:lock_version => (issue.lock_version - 1)
},
:notes => '',
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
assert_no_difference 'TimeEntry.count' do
assert_no_difference 'Attachment.count' do
put :update,
:id => issue.id,
:issue => {
:fixed_version_id => 4,
:lock_version => (issue.lock_version - 1)
},
:notes => '',
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}},
:time_entry => { :hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first }
end
end
end