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

Version Path
active_record-acts_as-2.2.1 spec/database_helper.rb
active_record-acts_as-2.2.0 spec/database_helper.rb
active_record-acts_as-2.1.1 spec/database_helper.rb
active_record-acts_as-2.1.0 spec/database_helper.rb
active_record-acts_as-2.0.9 spec/database_helper.rb
active_record-acts_as-2.0.8 spec/database_helper.rb
active_record-acts_as-2.0.6 spec/database_helper.rb
active_record-acts_as-2.0.5 spec/database_helper.rb
active_record-acts_as-2.0.4 spec/database_helper.rb
active_record-acts_as-2.0.3 spec/database_helper.rb
active_record-acts_as-2.0.2 spec/database_helper.rb
active_record-acts_as-2.0.1 spec/database_helper.rb
active_record-acts_as-2.0.0 spec/database_helper.rb
active_record-acts_as-1.0.8 spec/database_helper.rb
active_record-acts_as-1.0.7 spec/database_helper.rb
active_record-acts_as-1.0.6 spec/database_helper.rb
active_record-acts_as-1.0.5 spec/database_helper.rb
active_record-acts_as-1.0.4 spec/database_helper.rb
active_record-acts_as-1.0.3 spec/database_helper.rb
active_record-acts_as-1.0.2 spec/database_helper.rb