Sha256: 9e41b0f8b7b29a57161b440ebacf06fbcee620cabb691b6a64a7c2f2f112d315
Contents?: true
Size: 1.22 KB
Versions: 13
Compression:
Stored size: 1.22 KB
Contents
require File.dirname(__FILE__) + '/../test_helper.rb' module ConditionTests class KeywordsTest < ActiveSupport::TestCase def test_sanitize condition = Searchlogic::Condition::Keywords.new(Account, :column => Account.columns_hash["name"]) condition.value = "freedom yeah, freedom YEAH right" assert_equal ["\"accounts\".\"name\" LIKE ? AND \"accounts\".\"name\" LIKE ? AND \"accounts\".\"name\" LIKE ?", "%freedom%", "%yeah%", "%right%"], condition.sanitize condition = Searchlogic::Condition::Keywords.new(Account, :column => Account.columns_hash["name"]) condition.value = "%^$*(^$)" assert_nil condition.sanitize condition = Searchlogic::Condition::Keywords.new(Account, :column => Account.columns_hash["name"]) condition.value = "%^$*(^$) àáâãäåßéèêëìíîïñòóôõöùúûüýÿ" assert_equal ["\"accounts\".\"name\" LIKE ?", "%àáâãäåßéèêëìíîïñòóôõöùúûüýÿ%"], condition.sanitize condition = Searchlogic::Condition::Keywords.new(Account, :column => Account.columns_hash["name"]) condition.value = "ben@ben.com" assert_equal ["\"accounts\".\"name\" LIKE ?", "%ben@ben.com%"], condition.sanitize end end end
Version data entries
13 entries across 13 versions & 2 rubygems