summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-09-09 09:57:31 +0000
committerRémy Coutable <remy@rymai.me>2016-09-09 09:57:31 +0000
commit12cc675ceb2c52b3f39260b807e48be91edb598c (patch)
tree7ad47dd5db0e64a9714a273edcede8ac33d359e5 /spec/controllers
parentcf76776d03885c02b58df07dbca42bc455f4a841 (diff)
parent28e6bb39de56376fc4672ffc41927d63ad2f2440 (diff)
downloadgitlab-ce-12cc675ceb2c52b3f39260b807e48be91edb598c.tar.gz
Merge branch '21714-refresh-the-todos-count-cache-after-issuable-delete' into 'master'
Refresh todos count cache when an Issue/MR is deleted Fixes #21714 See merge request !6161
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/projects/issues_controller_spec.rb6
-rw-r--r--spec/controllers/projects/merge_requests_controller_spec.rb6
2 files changed, 12 insertions, 0 deletions
diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb
index 16929767ddf..90419368f22 100644
--- a/spec/controllers/projects/issues_controller_spec.rb
+++ b/spec/controllers/projects/issues_controller_spec.rb
@@ -370,6 +370,12 @@ describe Projects::IssuesController do
expect(response).to have_http_status(302)
expect(controller).to set_flash[:notice].to(/The issue was successfully deleted\./).now
end
+
+ it 'delegates the update of the todos count cache to TodoService' do
+ expect_any_instance_of(TodoService).to receive(:destroy_issue).with(issue, owner).once
+
+ delete :destroy, namespace_id: project.namespace.path, project_id: project.path, id: issue.iid
+ end
end
end
diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb
index a219400d75f..94c9edc91fe 100644
--- a/spec/controllers/projects/merge_requests_controller_spec.rb
+++ b/spec/controllers/projects/merge_requests_controller_spec.rb
@@ -320,6 +320,12 @@ describe Projects::MergeRequestsController do
expect(response).to have_http_status(302)
expect(controller).to set_flash[:notice].to(/The merge request was successfully deleted\./).now
end
+
+ it 'delegates the update of the todos count cache to TodoService' do
+ expect_any_instance_of(TodoService).to receive(:destroy_merge_request).with(merge_request, owner).once
+
+ delete :destroy, namespace_id: project.namespace.path, project_id: project.path, id: merge_request.iid
+ end
end
end