Sha256: f74d413885b48c5918611c5b04790e65c9532b293a22bb6bdcb01e78fdda6c21

Contents?: true

Size: 1.27 KB

Versions: 14

Compression:

Stored size: 1.27 KB

Contents

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

module ConditionTests
  class NilTest < ActiveSupport::TestCase
    def test_sanitize
      condition = Searchlogic::Condition::Nil.new(Account, :column => Account.columns_hash["id"])
      condition.value = true
      assert_equal "\"accounts\".\"id\" IS NULL", condition.sanitize
    
      condition = Searchlogic::Condition::Nil.new(Account, :column => Account.columns_hash["id"])
      condition.value = false
      assert_equal "\"accounts\".\"id\" IS NOT NULL", condition.sanitize
    
      condition = Searchlogic::Condition::Nil.new(Account, :column => Account.columns_hash["id"])
      condition.value = "true"
      assert_equal "\"accounts\".\"id\" IS NULL", condition.sanitize
    
      condition = Searchlogic::Condition::Nil.new(Account, :column => Account.columns_hash["id"])
      condition.value = "false"
      assert_equal "\"accounts\".\"id\" IS NOT NULL", condition.sanitize
    
      condition = Searchlogic::Condition::Nil.new(Account, :column => Account.columns_hash["id"])
      condition.value = nil
      assert_nil condition.sanitize
    
      condition = Searchlogic::Condition::Nil.new(Account, :column => Account.columns_hash["id"])
      condition.value = ""
      assert_nil condition.sanitize
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
schof-searchlogic-0.0.2 test/condition_tests/nil_test.rb
searchlogic-1.5.10 test/condition_tests/nil_test.rb
searchlogic-1.5.9 test/condition_tests/nil_test.rb
searchlogic-1.5.8 test/condition_tests/nil_test.rb
searchlogic-1.5.4 test/condition_tests/nil_test.rb
searchlogic-1.5.7 test/condition_tests/nil_test.rb
searchlogic-1.6.1 test/condition_tests/nil_test.rb
searchlogic-1.6.0 test/condition_tests/nil_test.rb
searchlogic-1.5.6 test/condition_tests/nil_test.rb
searchlogic-1.6.5 test/condition_tests/nil_test.rb
searchlogic-1.6.4 test/condition_tests/nil_test.rb
searchlogic-1.6.2 test/condition_tests/nil_test.rb
searchlogic-1.6.3 test/condition_tests/nil_test.rb
searchlogic-1.6.6 test/condition_tests/nil_test.rb