Sha256: 4504650e54e77f7433fec4b2fbd8e94b8d629e36b9613e53bb7509e8fa35c1a5

Contents?: true

Size: 808 Bytes

Versions: 7

Compression:

Stored size: 808 Bytes

Contents

require File.dirname(__FILE__) + '/../test_helper.rb'

module ConditionTests
  class EqualsTest < ActiveSupport::TestCase
    def test_sanitize
      condition = Searchlogic::Condition::Equals.new(Account, :column => Account.columns_hash["id"])
      condition.value = 12
      assert_equal ["\"accounts\".\"id\" = ?", 12], condition.sanitize
    
      condition = Searchlogic::Condition::Equals.new(Account, :column => Account.columns_hash["id"])
      condition.value = [1,2,3,4]
      assert_equal ["\"accounts\".\"id\" IN (?)", [1, 2, 3, 4]], condition.sanitize
    
      condition = Searchlogic::Condition::Equals.new(Account, :column => Account.columns_hash["id"])
      condition.value = (1..10)
      assert_equal ["\"accounts\".\"id\" BETWEEN ? AND ?", 1, 10], condition.sanitize
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
searchlogic-1.5.6 test/condition_tests/equals_test.rb
searchlogic-1.5.10 test/condition_tests/equals_test.rb
searchlogic-1.5.9 test/condition_tests/equals_test.rb
searchlogic-1.5.8 test/condition_tests/equals_test.rb
searchlogic-1.5.7 test/condition_tests/equals_test.rb
searchlogic-1.5.4 test/condition_tests/equals_test.rb
searchlogic-1.6.0 test/condition_tests/equals_test.rb