Skip to content

Commit

Permalink
Get rid of test where a search query starts with a # char and allow s…
Browse files Browse the repository at this point in the history
…tatuses to be searched when search query has a #
  • Loading branch information
jsgoldstein authored and Gargron committed Jul 8, 2023
1 parent ef226d5 commit c4aa5c9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/services/search_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def url_resource_symbol
def full_text_searchable?
return false unless Chewy.enabled?

statuses_search? && !@account.nil? && !((@query.start_with?('#') || @query.include?('@')) && !@query.include?(' '))
statuses_search? && !@account.nil? && !(@query.include?('@') && !@query.include?(' '))
end

def account_searchable?
Expand Down
11 changes: 1 addition & 10 deletions spec/services/search_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
allow(AccountSearchService).to receive(:new).and_return(service)

results = subject.call(query, nil, 10)
expect(service).to have_received(:call).with(query, nil, limit: 10, offset: 0, resolve: false, use_searchable_text: true, following: false)
expect(service).to have_received(:call).with(query, nil, limit: 10, offset: 0, resolve: false, start_with_hashtag: false, use_searchable_text: true, following: false)
expect(results).to eq empty_results.merge(accounts: [account])
end
end
Expand All @@ -92,15 +92,6 @@
expect(Tag).to_not have_received(:search_for)
expect(results).to eq empty_results
end

it 'does not include account when starts with # character' do
query = '#tag'
allow(AccountSearchService).to receive(:new)

results = subject.call(query, nil, 10)
expect(AccountSearchService).to_not have_received(:new)
expect(results).to eq empty_results
end
end
end
end
Expand Down

0 comments on commit c4aa5c9

Please sign in to comment.