Sha256: 98703ff91b36960b2dbba0a0506ade0edb1596cb00abb1a67fcad36856fb7332
Contents?: true
Size: 1.32 KB
Versions: 13
Compression:
Stored size: 1.32 KB
Contents
require 'rubygems' require 'test/unit' require 'shoulda' $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'has_constant' def setup_mongoid begin require 'mongoid' Mongoid.database = Mongo::Connection.new('localhost', @port).db('i18n_test') rescue LoadError => e puts "can't use Mongoid adapter because: #{e}" end end def setup_active_record begin require 'active_record' ActiveRecord::Base.connection true rescue LoadError => e puts "can't use ActiveRecord backend because: #{e.message}" rescue ActiveRecord::ConnectionNotEstablished connect_active_record true end end def connect_active_record connect_adapter ActiveRecord::Migration.verbose = false ActiveRecord::Schema.define(:version => 1) do create_table :users, :force => true do |t| t.integer :salutation end create_table :things, :force => true do |t| t.string :salutation end end end def connect_adapter ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ":memory:") end class Test::Unit::TestCase def setup Mongoid.database.collections.each do |collection| begin collection.drop rescue end end if defined?(Mongoid) User.delete_all if defined?(ActiveRecord) end end
Version data entries
13 entries across 13 versions & 1 rubygems