Test that spent time should not be added when issue update fails (#11283).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10621 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-10-12 21:30:12 +00:00
parent ad94777d9c
commit 7b5d15eca8
1 changed files with 18 additions and 0 deletions

View File

@ -2871,6 +2871,24 @@ class IssuesControllerTest < ActionController::TestCase
assert_equal spent_hours_before + 2.5, issue.spent_hours
end
def test_put_update_with_spent_time_and_failure_should_not_add_spent_time
@request.session[:user_id] = 2
assert_no_difference('TimeEntry.count') do
put :update,
:id => 1,
:issue => { :subject => '' },
:time_entry => { :hours => '2.5', :comments => 'should not be added', :activity_id => TimeEntryActivity.first.id }
assert_response :success
end
assert_select 'input[name=?][value=?]', 'time_entry[hours]', '2.5'
assert_select 'input[name=?][value=?]', 'time_entry[comments]', 'should not be added'
assert_select 'select[name=?]', 'time_entry[activity_id]' do
assert_select 'option[value=?][selected=selected]', TimeEntryActivity.first.id
end
end
def test_put_update_with_attachment_only
set_tmp_attachments_directory