Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2018-02-04 00:47:28 +0300
committerGrzegorz Bizon <grzegorz@gitlab.com>2018-02-04 00:47:28 +0300
commit5aea8dc1a6dc17d4a73e65f3c3a0f8b7e29686eb (patch)
tree036dd54a8a42575d5f0b6d3ef19a382476f2eb50 /spec/models/repository_spec.rb
parent91d2f92b1a09aa96e464962788cda57485c9a22f (diff)
parent05f17e4d720756cb5aea9e7697a6fa549372e536 (diff)
Merge branch 'fix/remove-duplicated-logic-between-model-and-lib-in-find-branch' into 'master'
Remove repo reloading logic from Repository#find_branch Closes #42609 See merge request gitlab-org/gitlab-ce!16815
Diffstat (limited to 'spec/models/repository_spec.rb')
-rw-r--r--spec/models/repository_spec.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index 1102b1c9006..54ca7ed0737 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -959,19 +959,19 @@ describe Repository do
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
+ context 'fresh_repo is true' do
+ it 'delegates the call to raw_repository' do
+ expect(repository.raw_repository).to receive(:find_branch).with('master', true)
- 2.times do
- expect(repository.find_branch('feature')).not_to be_nil
+ repository.find_branch('master', fresh_repo: true)
end
end
- it 'loads a branch with a cached repo' do
- expect(Gitlab::Git::Repository).to receive(:new).once.and_call_original
+ context 'fresh_repo is false' do
+ it 'delegates the call to raw_repository' do
+ expect(repository.raw_repository).to receive(:find_branch).with('master', false)
- 2.times do
- expect(repository.find_branch('feature', fresh_repo: false)).not_to be_nil
+ repository.find_branch('master', fresh_repo: false)
end
end
end