diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-12-06 13:22:45 +0100 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-12-06 13:41:28 +0100 |
commit | 5eb12bd75fff65bb2ea8677cc317877e45d3d6f8 (patch) | |
tree | 121c7e78aa6449cdf1a5ecc5c4dff44cb17737cd /spec | |
parent | 18201ace36f13eb916737154178d700feb4eeec6 (diff) | |
download | gitlab-ce-5eb12bd75fff65bb2ea8677cc317877e45d3d6f8.tar.gz |
Remove caching of Repository#has_visible_content?remove-has-visible-content-caching
This method already uses the cached method Repository#branch_count so
there's no point in also caching has_visible_content?.
Fixes gitlab-org/gitlab-ce#25278
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/repository_spec.rb | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index b797d19161d..d9b0e63eeb6 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -768,7 +768,6 @@ describe Repository, models: true do expect(repository).not_to receive(:expire_root_ref_cache) expect(repository).not_to receive(:expire_emptiness_caches) expect(repository).to receive(:expire_branches_cache) - expect(repository).to receive(:expire_has_visible_content_cache) repository.update_branch_with_hooks(user, 'new-feature') { new_rev } end @@ -786,7 +785,6 @@ describe Repository, models: true do expect(empty_repository).to receive(:expire_root_ref_cache) expect(empty_repository).to receive(:expire_emptiness_caches) expect(empty_repository).to receive(:expire_branches_cache) - expect(empty_repository).to receive(:expire_has_visible_content_cache) empty_repository.commit_file(user, 'CHANGELOG', 'Changelog!', 'Updates file content', 'master', false) @@ -829,15 +827,6 @@ describe Repository, models: true do expect(subject).to eq(true) end - - it 'caches the output' do - expect(repository).to receive(:branch_count). - once. - and_return(3) - - repository.has_visible_content? - repository.has_visible_content? - end end end @@ -918,20 +907,6 @@ describe Repository, models: true do end end - describe '#expire_has_visible_content_cache' do - it 'expires the visible content cache' do - repository.has_visible_content? - - expect(repository).to receive(:branch_count). - once. - and_return(0) - - repository.expire_has_visible_content_cache - - expect(repository.has_visible_content?).to eq(false) - end - end - describe '#expire_branch_cache' do # This method is private but we need it for testing purposes. Sadly there's # no other proper way of testing caching operations. @@ -967,7 +942,6 @@ describe Repository, models: true do allow(repository).to receive(:empty?).and_return(true) expect(cache).to receive(:expire).with(:empty?) - expect(repository).to receive(:expire_has_visible_content_cache) repository.expire_emptiness_caches end @@ -976,7 +950,6 @@ describe Repository, models: true do allow(repository).to receive(:empty?).and_return(false) expect(cache).not_to receive(:expire).with(:empty?) - expect(repository).not_to receive(:expire_has_visible_content_cache) repository.expire_emptiness_caches end @@ -1204,7 +1177,7 @@ describe Repository, models: true do describe '#after_create_branch' do it 'flushes the visible content cache' do - expect(repository).to receive(:expire_has_visible_content_cache) + expect(repository).to receive(:expire_branches_cache) repository.after_create_branch end @@ -1212,7 +1185,7 @@ describe Repository, models: true do describe '#after_remove_branch' do it 'flushes the visible content cache' do - expect(repository).to receive(:expire_has_visible_content_cache) + expect(repository).to receive(:expire_branches_cache) repository.after_remove_branch end |