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-5.2.0 spec/database_helper.rb
active_record-acts_as-5.1.0 spec/database_helper.rb
active_record-acts_as-5.0.3 spec/database_helper.rb
active_record-acts_as-5.0.2 spec/database_helper.rb
active_record-acts_as-5.0.1 spec/database_helper.rb
active_record-acts_as-5.0.0 spec/database_helper.rb
active_record-acts_as-4.0.3 spec/database_helper.rb
active_record-acts_as-4.0.2 spec/database_helper.rb
active_record-acts_as-4.0.1 spec/database_helper.rb
active_record-acts_as-4.0.0 spec/database_helper.rb
active_record-acts_as-3.1.0 spec/database_helper.rb
active_record-acts_as-3.0.2 spec/database_helper.rb
active_record-acts_as-3.0.1 spec/database_helper.rb
active_record-acts_as-3.0.0 spec/database_helper.rb
active_record-acts_as-2.5.0 spec/database_helper.rb
active_record-acts_as-2.4.2 spec/database_helper.rb
active_record-acts_as-2.4.1 spec/database_helper.rb
active_record-acts_as-2.4.0 spec/database_helper.rb
active_record-acts_as-2.3.1 spec/database_helper.rb
active_record-acts_as-2.3.0 spec/database_helper.rb