summaryrefslogtreecommitdiff
path: root/spec/models/repository_spec.rb
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-09-05 09:38:37 +0100
committerPhil Hughes <me@iamphill.com>2016-09-05 09:38:37 +0100
commitc735c53aae8681d95584d921f12020774e4fd23c (patch)
treeb84be165a8ed1f95452253747d2f8d5a0ff6bbf3 /spec/models/repository_spec.rb
parent85f6244ce852fb6b788ea660c7d0cbe14ec10a20 (diff)
parentfe3d94e8e2e3f5d54575a7f16440cc1711617d2b (diff)
downloadgitlab-ce-build-cancel-spinner.tar.gz
Merge branch 'master' into build-cancel-spinnerbuild-cancel-spinner
Diffstat (limited to 'spec/models/repository_spec.rb')
-rw-r--r--spec/models/repository_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index 1fea50ad42c..812c72c48cb 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -382,6 +382,24 @@ describe Repository, models: true do
end
end
+ describe '#find_branch' do
+ it 'loads a branch with a fresh repo' do
+ expect(Gitlab::Git::Repository).to receive(:new).twice.and_call_original
+
+ 2.times do
+ expect(repository.find_branch('feature')).not_to be_nil
+ end
+ end
+
+ it 'loads a branch with a cached repo' do
+ expect(Gitlab::Git::Repository).to receive(:new).once.and_call_original
+
+ 2.times do
+ expect(repository.find_branch('feature', fresh_repo: false)).not_to be_nil
+ end
+ end
+ end
+
describe '#rm_branch' do
let(:old_rev) { '0b4bc9a49b562e85de7cc9e834518ea6828729b9' } # git rev-parse feature
let(:blank_sha) { '0000000000000000000000000000000000000000' }