Project

General

Profile

Defect #34856 » add_test.patch

Mizuki ISHIKAWA, 2021-03-18 05:20

View differences:

test/functional/issues_controller_test.rb
6501 6501
    assert_select 'input[name=?][value=?]', 'time_entry[comments]', 'this is my comment'
6502 6502
  end
6503 6503

  
6504
  def test_put_with_spent_time_when_assigned_to_of_private_issue_is_update_at_the_same_time
6505
    @request.session[:user_id] = 3
6506
    user = User.find(3)
6507
    project = Project.find(1)
6508
    assert_equal 'default', user.roles_for_project(Project.find(1)).first.issues_visibility
6509

  
6510
    private_issue = Issue.generate!(author: user, is_private: true, project_id: project.id)
6511
    assert private_issue.visible?(user)
6512

  
6513
    assert_difference('TimeEntry.count', 1) do
6514
      put(
6515
        :update,
6516
        params: {
6517
          id: private_issue.id,
6518
          issue: { assigned_to_id: nil },
6519
          time_entry: {
6520
            comments: "add spent time", activity_id: TimeEntryActivity.first.id, hours: 1
6521
          }
6522
        }
6523
      )
6524
    end
6525
    assert_select '#errorExplanation', {text: /Log time is invalid/, count: 0}
6526
    assert_select '#errorExplanation', {text: /Issue is invalid/, count: 0}
6527
    assert_redirected_to action: 'show', id: private_issue.id
6528
    assert_not private_issue.reload.visible?(user)
6529
  end
6530

  
6504 6531
  def test_put_update_should_allow_fixed_version_to_be_set_to_a_subproject
6505 6532
    issue = Issue.find(2)
6506 6533
    @request.session[:user_id] = 2
(2-2/3)