require 'test/unit' class TestDropUserObjects < Test::Unit::TestCase include Marjoree def setup $db.do( "CREATE TABLE TEST_TABLE( id int NOT NULL, value int NOT NULL )" ) $db.do( "CREATE VIEW VW_TEST_TABLE AS SELECT * FROM TEST_TABLE" ) load_sproc 'test_sproc.sp' end def test_drop_user_tables drop_user_tables assert_equal 0, count( :sysobjects, {:type => 'U'} ) end def test_drop_user_tables drop_user_views assert_equal 0, count( :sysobjects, {:type => 'V'} ) end def test_drop_user_sprocs drop_user_sprocs assert_equal 0, count( :sysobjects, {:type => 'P'} ) end def teardown begin $db.do( "DROP PROCEDURE test_sproc" ) rescue end begin $db.do( "DROP VIEW VW_TEST_TABLE" ) rescue end begin $db.do( "DROP TABLE TEST_TABLE" ) rescue end end private def load_sproc( sproc_name ) dir = File.dirname(__FILE__) sproc_contents = IO.readlines( "#{dir}/../sprocs/#{sproc_name}" ).join $db.do sproc_contents end end