summaryrefslogtreecommitdiff
path: root/spec/services/issuable
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-12-08 12:17:22 +0000
committerSean McGivern <sean@gitlab.com>2017-12-18 12:23:00 +0000
commitef454f68e837e4e7360fe1518686dd56adbbb0a9 (patch)
tree72e67bbf1a2222d8a1007298478350b5cc9c02bd /spec/services/issuable
parent9429e8ac60a10436a0469d7d206d3f74a2c966c7 (diff)
downloadgitlab-ce-ef454f68e837e4e7360fe1518686dd56adbbb0a9.tar.gz
When the target is deleted, todos are destroyed, but we did not reset the todo cache for users with todos on the deleted target. This would only update after the next time the todo cache was updated for that user.
Diffstat (limited to 'spec/services/issuable')
-rw-r--r--spec/services/issuable/destroy_service_spec.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/spec/services/issuable/destroy_service_spec.rb b/spec/services/issuable/destroy_service_spec.rb
index d74d98c6079..0a3647a814f 100644
--- a/spec/services/issuable/destroy_service_spec.rb
+++ b/spec/services/issuable/destroy_service_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe Issuable::DestroyService do
let(:user) { create(:user) }
- let(:project) { create(:project) }
+ let(:project) { create(:project, :public) }
subject(:service) { described_class.new(project, user) }
@@ -19,6 +19,13 @@ describe Issuable::DestroyService do
service.execute(issue)
end
+
+ it 'updates the todo caches for users with todos on the issue' do
+ create(:todo, target: issue, user: user, author: user, project: project)
+
+ expect { service.execute(issue) }
+ .to change { user.todos_pending_count }.from(1).to(0)
+ end
end
context 'when issuable is a merge request' do
@@ -33,6 +40,13 @@ describe Issuable::DestroyService do
service.execute(merge_request)
end
+
+ it 'updates the todo caches for users with todos on the merge request' do
+ create(:todo, target: merge_request, user: user, author: user, project: project)
+
+ expect { service.execute(merge_request) }
+ .to change { user.todos_pending_count }.from(1).to(0)
+ end
end
end
end