diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index dd85bb5d1..c8418628b 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -6501,6 +6501,33 @@ class IssuesControllerTest < Redmine::ControllerTest assert_select 'input[name=?][value=?]', 'time_entry[comments]', 'this is my comment' end + def test_put_with_spent_time_when_assigned_to_of_private_issue_is_update_at_the_same_time + @request.session[:user_id] = 3 + user = User.find(3) + project = Project.find(1) + assert_equal 'default', user.roles_for_project(Project.find(1)).first.issues_visibility + + private_issue = Issue.generate!(author: user, is_private: true, project_id: project.id) + assert private_issue.visible?(user) + + assert_difference('TimeEntry.count', 1) do + put( + :update, + params: { + id: private_issue.id, + issue: { assigned_to_id: nil }, + time_entry: { + comments: "add spent time", activity_id: TimeEntryActivity.first.id, hours: 1 + } + } + ) + end + assert_select '#errorExplanation', {text: /Log time is invalid/, count: 0} + assert_select '#errorExplanation', {text: /Issue is invalid/, count: 0} + assert_redirected_to action: 'show', id: private_issue.id + assert_not private_issue.reload.visible?(user) + end + def test_put_update_should_allow_fixed_version_to_be_set_to_a_subproject issue = Issue.find(2) @request.session[:user_id] = 2