Sha256: f00929e946d509204078ec0643b03ff335e01e70f87454cc2a4b268411b19dc3

Contents?: true

Size: 1.43 KB

Versions: 10

Compression:

Stored size: 1.43 KB

Contents

require 'test/unit'
require 'active_support/test_case'
require 'active_record'

require 'logging'
Logging.init :debug2, :debug, :trace, :verbose, :info, :warn, :error
include Logging.globally

begin
    # require 'turn'
rescue LoadError
end


# Set up the database.
def setup_database
    if not ActiveRecord::Base.connected?
        ActiveRecord::Base.establish_connection( :adapter => 'sqlite3', :database => ':memory:', :timeout => 5000 )
        ActiveRecord::Migrator.migrate( [ 'db/migrations' ] )
    end
end

def close_database
    ActiveRecord::Base.remove_connection
end

def assert_attributes( obj, attr )

    attr.each do |key, val|
        case val
        when :not_nil
            assert_not_nil( obj.send( key ), "#{key.to_s} should not be nil." )
        when :nil
            assert_nil( obj.send( key ), "#{key.to_s} should be nil." )
        else
            if val.is_a?( Hash )
                assert_not_nil( obj.send( key ), "#{key.to_s} should not be nil." )
                assert_attributes( obj.send( key ), val )
            elsif val.is_a?( Proc )
                val.call( obj.send( key ) )
            else
                assert_equal( val, obj.send( key ) )
            end
        end
    end

end

class RepositoryMock
    attr_accessor :name
    def initialize( name )
        @name = name
    end
end

class ModuleMock
    attr_accessor :name
    def initialize( name )
        @name = name
    end
end # class ModuleMock

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
build-tool-0.6.9 test/test_helper.rb
build-tool-0.6.8 test/test_helper.rb
build-tool-0.6.7 test/test_helper.rb
build-tool-0.6.6 test/test_helper.rb
build-tool-0.6.5 test/test_helper.rb
build-tool-0.6.4 test/test_helper.rb
build-tool-0.6.3 test/test_helper.rb
build-tool-0.6.2 test/test_helper.rb
build-tool-0.6.1 test/test_helper.rb
build-tool-0.6.0 test/test_helper.rb