handle special chars; write tests for special chars

This commit is contained in:
Bilal Catic
2020-01-31 13:58:09 +01:00
parent 9c2aff53d7
commit 793e26e01f
2 changed files with 23 additions and 6 deletions

View File

@@ -85,5 +85,11 @@ class SqlGeneratorTester
expect(@query.where_clause).to eq ['(players.title LIKE ? AND NOT (players.title LIKE ? OR players.title LIKE ?))', '%a%', '%b%', '%c%']
end
it 'tests search with special characters in search term' do
@query = TextToSqlQuery.new('title:"%a_\"', [:'players.title', :'players.tag', :'players.device_id'], :'players.device_id')
expect(@query.where_clause).to eq ['players.title LIKE ?', '%"\%a\_\\"%']
end
end
end