Sha256: 48f8fec35026efcae638c023f4a10bc2a99a3c9068c91dab8112c581674b10d4
Contents?: true
Size: 832 Bytes
Versions: 2
Compression:
Stored size: 832 Bytes
Contents
require 'pathname' require 'yaml' require 'ar_transaction_changes' require 'minitest/autorun' ENV["RAILS_ENV"] = "test" test_dir = Pathname.new(File.dirname(__FILE__)) config_filename = test_dir.join("database.yml").exist? ? "database.yml" : "database.yml.default" database_yml = YAML.load(test_dir.join(config_filename).read) database_config = database_yml.fetch("test") ActiveRecord::Base.establish_connection(database_config.except("database")) ActiveRecord::Base.connection.recreate_database(database_config.fetch("database")) ActiveRecord::Base.establish_connection(database_config) ActiveRecord::Base.connection.tap do |db| db.create_table(:users) do |t| t.string :name t.string :occupation t.integer :age t.timestamps null: false end end Dir[test_dir.join("models/*.rb")].each{ |file| require file }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ar_transaction_changes-1.1.6 | test/test_helper.rb |
ar_transaction_changes-1.1.5 | test/test_helper.rb |