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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-05-19 18:44:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-19 18:44:42 +0300
commit4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch)
tree5423a1c7516cffe36384133ade12572cf709398d /spec/finders/repositories
parente570267f2f6b326480d284e0164a6464ba4081bc (diff)
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'spec/finders/repositories')
-rw-r--r--spec/finders/repositories/branch_names_finder_spec.rb39
1 files changed, 26 insertions, 13 deletions
diff --git a/spec/finders/repositories/branch_names_finder_spec.rb b/spec/finders/repositories/branch_names_finder_spec.rb
index 4d8bfcc0f20..40f5d339832 100644
--- a/spec/finders/repositories/branch_names_finder_spec.rb
+++ b/spec/finders/repositories/branch_names_finder_spec.rb
@@ -5,21 +5,34 @@ require 'spec_helper'
RSpec.describe Repositories::BranchNamesFinder do
let(:project) { create(:project, :repository) }
- let(:branch_names_finder) { described_class.new(project.repository, search: 'conflict-*') }
-
describe '#execute' do
- subject(:execute) { branch_names_finder.execute }
-
- it 'filters branch names' do
- expect(execute).to contain_exactly(
- 'conflict-binary-file',
- 'conflict-resolvable',
- 'conflict-contains-conflict-markers',
- 'conflict-missing-side',
- 'conflict-start',
- 'conflict-non-utf8',
- 'conflict-too-large'
+ it 'returns all filtered branch names' do
+ expect(create_branch_names_finder(0, 100).execute).to contain_exactly(
+ 'snippet/edit-file',
+ 'snippet/multiple-files',
+ 'snippet/no-files',
+ 'snippet/rename-and-edit-file',
+ 'snippet/single-file'
)
end
+
+ it 'returns a limited number of offset filtered branch names' do
+ starting_names = create_branch_names_finder(0, 3).execute
+ offset_names = create_branch_names_finder(3, 2).execute
+
+ expect(starting_names.count).to eq(3)
+ expect(offset_names.count).to eq(2)
+
+ expect(offset_names).not_to include(*starting_names)
+
+ all_names = create_branch_names_finder(0, 100).execute
+ expect(all_names).to contain_exactly(*starting_names, *offset_names)
+ end
+
+ private
+
+ def create_branch_names_finder(offset, limit)
+ described_class.new(project.repository, search: 'snippet/*', offset: offset, limit: limit)
+ end
end
end