class TestDBIndexer
Public Instance Methods
setup_db()
click to toggle source
# File vendor/qwik/lib/qwik/db-indexer.rb, line 97 def setup_db config = Qwik::Config.new spath = config.super_dir.path path = './.test/'.path path.setup db = Qwik::FileSystemDB.new(path, spath) return path, db end
teardown_db(path)
click to toggle source
# File vendor/qwik/lib/qwik/db-indexer.rb, line 106 def teardown_db(path) path.teardown end
test_all()
click to toggle source
# File vendor/qwik/lib/qwik/db-indexer.rb, line 110 def test_all # setup path, db = setup_db # Initialize DBIndexer. indexer = Qwik::DBIndexer.new(path) db.register_observer(indexer) # Regist to the DB. # Put test contents. db.put('a', 'This is a test.') db.put('b', 'This is a test, too.') # test_search if $have_senna_so ok_eq(['a', 'b'], indexer.search('test')) ok_eq(['b'], indexer.search('too')) ok_eq([], indexer.search('nosuch')) end teardown_db(path) end
test_pre_content()
click to toggle source
# File vendor/qwik/lib/qwik/db-indexer.rb, line 132 def test_pre_content # Setup db path, db = setup_db # Put test contents before to setup indexer. db.put('a', 'This is a test.') db.put('b', 'This is a test, too.') # Initialize DBIndexer. indexer = Qwik::DBIndexer.new(path) db.register_observer(indexer) # Regist to the DB. # test_search if $have_senna_so ok_eq(['a', 'b'], indexer.search('test')) ok_eq(['b'], indexer.search('too')) ok_eq([], indexer.search('nosuch')) end teardown_db(path) end