Sha256: a2c9cd62dc3c0a5ac585a562e3eda2edb3aa199896251275a6e7479c101d08d9
Contents?: true
Size: 603 Bytes
Versions: 44
Compression:
Stored size: 603 Bytes
Contents
require 'active_record' def connect_to_databse ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:' end def clear_database ActiveRecord::Base.descendants.each do |model| model.delete_all if model.table_exists? end end def reset_database ActiveRecord::Base.descendants.map(&:reset_column_information) ActiveRecord::Base.connection.disconnect! connect_to_databse end def initialize_database(&block) reset_database ActiveRecord::Schema.define(&block) end I18n.enforce_available_locales = false ActiveRecord::Migration.verbose = false connect_to_databse
Version data entries
44 entries across 44 versions & 1 rubygems