Sha256: 1b54f9da41e5eff543bfbf86f76b9c3187edab1f985904229df57f45e89226e4
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
module Apartment module Test extend self def reset Apartment.excluded_models = nil Apartment.use_schemas = nil Apartment.seed_after_create = nil Apartment.default_schema = nil end def next_db @x ||= 0 "db%d" % @x += 1 end def reset_table_names Apartment.excluded_models.each do |model| model.constantize.reset_table_name end end def drop_schema(schema) ActiveRecord::Base.connection.execute("DROP SCHEMA IF EXISTS #{schema} CASCADE") rescue true end # Use this if you don't want to import schema.rb etc... but need the postgres schema to exist # basically for speed purposes def create_schema(schema) ActiveRecord::Base.connection.execute("CREATE SCHEMA #{schema}") end def load_schema(version = 3) file = File.expand_path("../../schemas/v#{version}.rb", __FILE__) silence_warnings{ load(file) } end def migrate ActiveRecord::Migrator.migrate(Rails.root + ActiveRecord::Migrator.migrations_path) end def rollback ActiveRecord::Migrator.rollback(Rails.root + ActiveRecord::Migrator.migrations_path) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
apartment-1.1.0 | spec/support/apartment_helpers.rb |