require 'test/unit' class TestNumRowsOnMarjoree < Test::Unit::TestCase include Marjoree def setup $db.do( "CREATE TABLE TEST_TABLE( id int NOT NULL, value int NOT NULL )" ) $db.do( "INSERT INTO TEST_TABLE ( id, value ) VALUES( 0, 10 )" ) $db.do( "INSERT INTO TEST_TABLE ( id, value ) VALUES( 1, 11 )" ) end def test_num_rows_for_table assert_equal( 2, num_rows( "TEST_TABLE" ) ) end def test_num_rows_for_table_using_where assert_equal( 1, num_rows( "TEST_TABLE", {:id=>1} ) ) end def test_num_rows_with_bad_table begin num_rows( "TABLE_NOT_INT_DB" ) fail rescue ODBC::Error end end def teardown $db.do( "TRUNCATE TABLE TEST_TABLE" ) $db.do( "DROP TABLE TEST_TABLE" ) end end