diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-10-09 14:16:38 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-10-09 14:16:38 +0000 |
commit | a550942de1085eae4c60c498097ab191f8acfc0c (patch) | |
tree | a4a3944c7174baaca529ebf67f1434ae8407bf1a /spec | |
parent | 9fe93e3c3ad3f4896c91d5dde62e879c8d939be2 (diff) | |
parent | d6612fbcee7245325ee9799f49b5ea46a5037308 (diff) | |
download | gitlab-ce-a550942de1085eae4c60c498097ab191f8acfc0c.tar.gz |
Merge branch 'jk-assignees-todos-fix' into 'master'
CE Backport of "Don't create todos for old issue assignees"
See merge request gitlab-org/gitlab-ce!14765
Diffstat (limited to 'spec')
-rw-r--r-- | spec/services/issues/update_service_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb index bdbe0a353fb..f07b81e842a 100644 --- a/spec/services/issues/update_service_spec.rb +++ b/spec/services/issues/update_service_spec.rb @@ -267,6 +267,30 @@ describe Issues::UpdateService, :mailer do end end + context 'when a new assignee added' do + subject { update_issue(assignees: issue.assignees + [user2]) } + + it 'creates only 1 new todo' do + expect { subject }.to change { Todo.count }.by(1) + end + + it 'creates a todo for new assignee' do + subject + + attributes = { + project: project, + author: user, + user: user2, + target_id: issue.id, + target_type: issue.class.name, + action: Todo::ASSIGNED, + state: :pending + } + + expect(Todo.where(attributes).count).to eq(1) + end + end + context 'when the milestone change' do it 'marks todos as done' do update_issue(milestone: create(:milestone)) |