Sha256: c3bcf23a102ca4664bec9233f2c484a61311dc511cca0058d410f3bba5096754

Contents?: true

Size: 938 Bytes

Versions: 2

Compression:

Stored size: 938 Bytes

Contents

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

class TestSearchConditions < Test::Unit::TestCase
  def test_conditions
    search = Account.new_search
    assert_kind_of Searchgasm::Conditions::Base, search.conditions
    assert_equal search.conditions.klass, Account
  
    search.conditions = {:name_like => "Binary"}
    assert_kind_of Searchgasm::Conditions::Base, search.conditions
    
    search = Account.new_search(:conditions => {:name_like => "Ben"})
    assert_equal({:name_like => "Ben"}, search.conditions.conditions)
  end
  
  def test_auto_joins
    search = Account.new_search
    search.conditions = {:name_like => "Binary"}
    assert_equal nil, search.auto_joins
    search.conditions.users.first_name_like = "Ben"
    assert_equal :users, search.auto_joins
    search.conditions.reset_users!
    assert_equal nil, search.auto_joins
  end
  
  def test_sanitize
    # This is tested in test_search_base
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
searchgasm-1.3.4 test/test_search_conditions.rb
searchgasm-1.3.5 test/test_search_conditions.rb