FIX: Short terms will be searched for if at least one is long enough
This commit is contained in:
parent
58834663a8
commit
7e165d031b
|
@ -196,7 +196,6 @@ class Search
|
|||
@valid = false
|
||||
return
|
||||
end
|
||||
@term = terms.join(' ') if @term.include?(' ')
|
||||
end
|
||||
|
||||
# If the term is a number or url to a topic, just include that topic
|
||||
|
|
|
@ -67,7 +67,7 @@ describe Search do
|
|||
expect(search.term).to eq('')
|
||||
end
|
||||
|
||||
it 'does not search for multiple small terms' do
|
||||
it 'needs at least one term that hits the length' do
|
||||
search = Search.new('a b c d', min_search_term_length: 5)
|
||||
search.execute
|
||||
expect(search.valid?).to eq(false)
|
||||
|
@ -81,11 +81,11 @@ describe Search do
|
|||
expect(search.term).to eq('"a b c d"')
|
||||
end
|
||||
|
||||
it 'discards short terms' do
|
||||
it 'searches for short terms if one hits the length' do
|
||||
search = Search.new('a b c okaylength', min_search_term_length: 5)
|
||||
search.execute
|
||||
expect(search.valid?).to eq(true)
|
||||
expect(search.term).to eq('okaylength')
|
||||
expect(search.term).to eq('a b c okaylength')
|
||||
end
|
||||
|
||||
it 'escapes non alphanumeric characters' do
|
||||
|
|
Loading…
Reference in New Issue