Commit 1cf35c3d authored by George Andrinopoulos's avatar George Andrinopoulos

Add case insensitive branches search

parent cc8af554
...@@ -23,7 +23,7 @@ class BranchesFinder ...@@ -23,7 +23,7 @@ class BranchesFinder
def filter_by_name(branches) def filter_by_name(branches)
if search if search
branches.select { |branch| branch.name.include?(search) } branches.select { |branch| branch.name.upcase.include?(search.upcase) }
else else
branches branches
end end
......
---
title: Case insensitive search for branches
merge_request: 14995
author: George Andrinopoulos
type: fixed
...@@ -46,6 +46,15 @@ describe BranchesFinder do ...@@ -46,6 +46,15 @@ describe BranchesFinder do
expect(result.count).to eq(1) expect(result.count).to eq(1)
end end
it 'filters branches by name ignoring letter case' do
branches_finder = described_class.new(repository, { search: 'FiX' })
result = branches_finder.execute
expect(result.first.name).to eq('fix')
expect(result.count).to eq(1)
end
it 'does not find any branch with that name' do it 'does not find any branch with that name' do
branches_finder = described_class.new(repository, { search: 'random' }) branches_finder = described_class.new(repository, { search: 'random' })
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment