diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2017-09-01 11:51:55 +0200 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2017-09-01 11:51:55 +0200 |
commit | 0aadf36b4a0d6f1dd1f25f7c54815782bab3596b (patch) | |
tree | 1c7d851f3a08b6cd1ee4c30021ddd7f63d0601c8 /spec/models/repository_spec.rb | |
parent | ee1aede5835d8a4f87ede13c9bc49176e36faec7 (diff) | |
download | gitlab-ce-0aadf36b4a0d6f1dd1f25f7c54815782bab3596b.tar.gz |
Restore with_branch cache spec
Diffstat (limited to 'spec/models/repository_spec.rb')
-rw-r--r-- | spec/models/repository_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index a7736185c84..95e11c4af20 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -1068,6 +1068,24 @@ describe Repository, models: true do end end + context 'when target branch is different from source branch' do + before do + allow_any_instance_of(Gitlab::Git::Hook).to receive(:trigger).and_return([true, '']) + end + + it 'expires branch cache' do + expect(repository).not_to receive(:expire_exists_cache) + expect(repository).not_to receive(:expire_root_ref_cache) + expect(repository).not_to receive(:expire_emptiness_caches) + expect(repository).to receive(:expire_branches_cache) + + repository.with_branch(user, 'new-feature') do + new_rev + end + end + end + + context 'when repository is empty' do before do allow_any_instance_of(Gitlab::Git::Hook).to receive(:trigger).and_return([true, '']) |