Sha256: df097646de85b5f112637b4315940b4b01e31184541006126fdef5cb85f35a27

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
marjoree-0.0.9 ./tests/marjoree/test_drop_user_objects.rb