Sha256: 4caf99ec24bf34d48e052c316683860029681290fb3f69ad543338340974c95a
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
require 'assert' require 'ardb' class PostgresqlDbTests < Assert::Context setup do @orig_env_ardb_db_file = ENV['ARDB_DB_FILE'] ActiveRecord::Base.logger = @orig_ar_loggerF # no-op, we're manually configuring ardb so we don't need this to do anything ENV['ARDB_DB_FILE'] = File.join(TEST_SUPPORT_PATH, 'require_test_db_file') @ardb_config = Ardb::Config.new.tap do |c| c.adapter = 'postgresql' c.database = 'redding_ardb_test' c.encoding = 'unicode' c.min_messages = 'WARNING' c.logger = TEST_LOGGER c.root_path = File.join(TEST_SUPPORT_PATH, 'postgresql') c.migrations_path = 'migrations' c.schema_path = 'schema' c.schema_format = :ruby end Assert.stub(Ardb, :config){ @ardb_config } Ardb.init(false) Ardb.adapter.drop_db Ardb.adapter.create_db Ardb.adapter.load_schema Ardb.adapter.connect_db end teardown do Ardb.reset_adapter ActiveRecord::Base.logger = @orig_ar_logger ENV['ARDB_DB_FILE'] = @orig_env_ardb_db_file end private # useful when testing creating/dropping/migrating DBs def silence_stdout current_stdout = $stdout.dup $stdout = File.new('/dev/null', 'w') begin yield ensure $stdout = current_stdout end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ardb-0.28.3 | test/support/postgresql/setup_test_db.rb |