summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorAhmad Sherif <me@ahmadsherif.com>2017-12-28 19:07:21 +0100
committerAhmad Sherif <me@ahmadsherif.com>2018-01-11 14:52:15 +0100
commit831019412f32089935755215db609b78794f997a (patch)
tree3120a616a2b5815960fe61e141be002f87d59583 /spec
parentbe623ef3c1a867d23e9625fe372c17fcad3c47ce (diff)
downloadgitlab-ce-831019412f32089935755215db609b78794f997a.tar.gz
Migrate merged_branch_names to Gitaly
Closes gitaly#851
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/git/repository_spec.rb66
1 files changed, 38 insertions, 28 deletions
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb
index f346a345f00..f4e781c599e 100644
--- a/spec/lib/gitlab/git/repository_spec.rb
+++ b/spec/lib/gitlab/git/repository_spec.rb
@@ -1283,48 +1283,58 @@ describe Gitlab::Git::Repository, seed_helper: true do
end
describe '#merged_branch_names' do
- context 'when branch names are passed' do
- it 'only returns the names we are asking' do
- names = repository.merged_branch_names(%w[merge-test])
+ shared_examples 'finding merged branch names' do
+ context 'when branch names are passed' do
+ it 'only returns the names we are asking' do
+ names = repository.merged_branch_names(%w[merge-test])
- expect(names).to contain_exactly('merge-test')
- end
+ expect(names).to contain_exactly('merge-test')
+ end
- it 'does not return unmerged branch names' do
- names = repository.merged_branch_names(%w[feature])
+ it 'does not return unmerged branch names' do
+ names = repository.merged_branch_names(%w[feature])
- expect(names).to be_empty
+ expect(names).to be_empty
+ end
end
- end
- context 'when no root ref is available' do
- it 'returns empty list' do
- project = create(:project, :empty_repo)
+ context 'when no root ref is available' do
+ it 'returns empty list' do
+ project = create(:project, :empty_repo)
- names = project.repository.merged_branch_names(%w[feature])
+ names = project.repository.merged_branch_names(%w[feature])
- expect(names).to be_empty
+ expect(names).to be_empty
+ end
end
- end
- context 'when no branch names are specified' do
- before do
- repository.create_branch('identical', 'master')
- end
+ context 'when no branch names are specified' do
+ before do
+ repository.create_branch('identical', 'master')
+ end
- after do
- ensure_seeds
- end
+ after do
+ ensure_seeds
+ end
- it 'returns all merged branch names except for identical one' do
- names = repository.merged_branch_names
+ it 'returns all merged branch names except for identical one' do
+ names = repository.merged_branch_names
- expect(names).to include('merge-test')
- expect(names).to include('fix-mode')
- expect(names).not_to include('feature')
- expect(names).not_to include('identical')
+ expect(names).to include('merge-test')
+ expect(names).to include('fix-mode')
+ expect(names).not_to include('feature')
+ expect(names).not_to include('identical')
+ end
end
end
+
+ context 'when Gitaly merged_branch_names feature is enabled' do
+ it_behaves_like 'finding merged branch names'
+ end
+
+ context 'when Gitaly merged_branch_names feature is disabled', :disable_gitaly do
+ it_behaves_like 'finding merged branch names'
+ end
end
describe "#ls_files" do