diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-09-19 14:55:56 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2017-09-19 18:16:45 +0300 |
commit | 57b96eb6db9b860991b035714e65ffd557327b6f (patch) | |
tree | 885c999406eeea7b8f73d6262db9a3043e86ad79 /spec/services/merge_requests/create_service_spec.rb | |
parent | 404a56235f86a69b05991efcf4cc5d7c5f5c4567 (diff) |
Fix refreshing of issues/MR count caches
This ensures the open issues/MR count caches are refreshed properly when
creating new issues or MRs. This MR also includes a change to the cache
keys to ensure all caches are rebuilt on the fly.
This particular problem was not caught in the test suite due to a null
cache being used, resulting in all calls that would use a cache using
the underlying data directly. In production the code would fail because
a newly saved record returns an empty hash in #changes meaning checks
such as `state_changed? || confidential_changed?` would return false for
new rows, thus never updating the counters.
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/38061
Diffstat (limited to 'spec/services/merge_requests/create_service_spec.rb')
-rw-r--r-- | spec/services/merge_requests/create_service_spec.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/spec/services/merge_requests/create_service_spec.rb b/spec/services/merge_requests/create_service_spec.rb index d6409c0d625..a047f891ab2 100644 --- a/spec/services/merge_requests/create_service_spec.rb +++ b/spec/services/merge_requests/create_service_spec.rb @@ -37,7 +37,7 @@ describe MergeRequests::CreateService do expect(service).to have_received(:execute_hooks).with(merge_request) end - it 'refreshes the number of open merge requests' do + it 'refreshes the number of open merge requests', :use_clean_rails_memory_store_caching do expect { service.execute } .to change { project.open_merge_requests_count }.from(0).to(1) end |