diff options
author | Valery Sizov <valery@gitlab.com> | 2017-05-10 23:54:10 +0300 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2017-05-12 14:12:29 +0300 |
commit | e2a3a5095abd8c1fa57dd19e4ff693ae4021fde8 (patch) | |
tree | 435cd38964d20a0b1ad67b9dc02dcdbbe76d00c1 /spec/services/issues | |
parent | 92bf7dfcb040e3e035fc87b0a70461f891284c98 (diff) |
Move update_assignee_cache_counts to the service
Diffstat (limited to 'spec/services/issues')
-rw-r--r-- | spec/services/issues/create_service_spec.rb | 16 | ||||
-rw-r--r-- | spec/services/issues/update_service_spec.rb | 7 |
2 files changed, 23 insertions, 0 deletions
diff --git a/spec/services/issues/create_service_spec.rb b/spec/services/issues/create_service_spec.rb index 01edc46496d..dab1a3469f7 100644 --- a/spec/services/issues/create_service_spec.rb +++ b/spec/services/issues/create_service_spec.rb @@ -118,6 +118,22 @@ describe Issues::CreateService, services: true do end end + context 'when assignee is set' do + let(:opts) do + { title: 'Title', + description: 'Description', + assignees: [assignee] } + end + + it 'invalidates open issues counter for assignees when issue is assigned' do + project.team << [assignee, :master] + + described_class.new(project, user, opts).execute + + expect(assignee.assigned_open_issues_count).to eq 1 + end + end + it 'executes issue hooks when issue is not confidential' do opts = { title: 'Title', description: 'Description', confidential: false } diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb index 1954d8739f6..5184c1d5f19 100644 --- a/spec/services/issues/update_service_spec.rb +++ b/spec/services/issues/update_service_spec.rb @@ -59,6 +59,13 @@ describe Issues::UpdateService, services: true do expect(issue.due_date).to eq Date.tomorrow end + it 'updates open issue counter for assignees when issue is reassigned' do + update_issue(assignee_ids: [user2.id]) + + expect(user3.assigned_open_issues_count).to eq 0 + expect(user2.assigned_open_issues_count).to eq 1 + end + it 'sorts issues as specified by parameters' do issue1 = create(:issue, project: project, assignees: [user3]) issue2 = create(:issue, project: project, assignees: [user3]) |