summaryrefslogtreecommitdiff
path: root/spec/services
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2017-09-28 17:47:18 +0000
committerRobert Speicher <robert@gitlab.com>2017-09-28 17:47:18 +0000
commitff7deb33aef29871d8619d1f56e2c347c7b7f9a4 (patch)
tree62e9de267a2874b0b6e7b8c615d3bfde89be630d /spec/services
parentae03a52f0927f5f0881e3269faba90028e6d808b (diff)
parentdc32128de976d864ca143c4b56fa1b45531e277e (diff)
downloadgitlab-ce-ff7deb33aef29871d8619d1f56e2c347c7b7f9a4.tar.gz
Merge branch 'fix-mr-sidebar-counter-after-merge' into 'master'
Clear merge requests counter cache after merge Closes gitlab-ee#3573 and #38344 See merge request gitlab-org/gitlab-ce!14563
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/merge_requests/post_merge_service_spec.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/services/merge_requests/post_merge_service_spec.rb b/spec/services/merge_requests/post_merge_service_spec.rb
index a37cdab8928..d2bd05d921f 100644
--- a/spec/services/merge_requests/post_merge_service_spec.rb
+++ b/spec/services/merge_requests/post_merge_service_spec.rb
@@ -11,5 +11,16 @@ describe MergeRequests::PostMergeService do
describe '#execute' do
it_behaves_like 'cache counters invalidator'
+
+ it 'refreshes the number of open merge requests for a valid MR', :use_clean_rails_memory_store_caching do
+ # Cache the counter before the MR changed state.
+ project.open_merge_requests_count
+ merge_request.update!(state: 'merged')
+
+ service = described_class.new(project, user, {})
+
+ expect { service.execute(merge_request) }
+ .to change { project.open_merge_requests_count }.from(1).to(0)
+ end
end
end