Sha256: 1e2339481d2c07fe5cf046bbaf3a61e0210596286a532d03c7a502b14d0fd622

Contents?: true

Size: 825 Bytes

Versions: 2

Compression:

Stored size: 825 Bytes

Contents

require 'test/unit'

class TestTruncateOnMarjoree < 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_truncate
        assert( num_rows( "TEST_TABLE" ) > 0 )

        truncate( "TEST_TABLE" )
        assert_equal( 0, num_rows( "TEST_TABLE" ) )
    end

    def test_truncate_with_bad_table
        begin
            truncate( "TABLE_NOT_IN_DB" )
            fail
        rescue ODBC::Error
        end
    end

    def teardown
        $db.do( "TRUNCATE TABLE TEST_TABLE" )
        $db.do( "DROP TABLE TEST_TABLE" )
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
marjoree-0.0.1 ./tests/test_truncate.rb
marjoree-0.0.9 ./tests/marjoree/test_truncate.rb