summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-04-14 15:36:36 -0700
committerStan Hu <stanhu@gmail.com>2018-04-14 15:36:36 -0700
commit74e5ec198cbafe5d83690fae970ff73e5ef4cfcb (patch)
tree7f1897390cbdbb9d276311c28b36dbe04f0862a2 /spec
parentb1f15dfa42fb7b8f74a439806f004eaa5ed598a8 (diff)
downloadgitlab-ce-74e5ec198cbafe5d83690fae970ff73e5ef4cfcb.tar.gz
Fix failing ./spec/lib/backup/repository_spec.rb by clearing the memoized value
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/git/repository_spec.rb3
-rw-r--r--spec/models/repository_spec.rb6
2 files changed, 8 insertions, 1 deletions
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb
index f6bf7a162f6..5acf40ea5ce 100644
--- a/spec/lib/gitlab/git/repository_spec.rb
+++ b/spec/lib/gitlab/git/repository_spec.rb
@@ -463,13 +463,14 @@ describe Gitlab::Git::Repository, seed_helper: true do
it 'returns false when there are no branches' do
# Sanity check
- expect(repository.uncached_has_local_branches?).to eq(true)
+ expect(repository.has_local_branches?).to eq(true)
FileUtils.rm_rf(File.join(repository.path, 'packed-refs'))
heads_dir = File.join(repository.path, 'refs/heads')
FileUtils.rm_rf(heads_dir)
FileUtils.mkdir_p(heads_dir)
+ repository.expire_has_local_branches_cache
expect(repository.has_local_branches?).to eq(false)
end
end
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index 60ab52565cb..e45fe7db1e7 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -1437,6 +1437,12 @@ describe Repository do
repository.expire_emptiness_caches
end
+
+ it 'expires the memoized repository cache' do
+ allow(repository.raw_repository).to receive(:expire_has_local_branches_cache).and_call_original
+
+ repository.expire_emptiness_caches
+ end
end
describe 'skip_merges option' do