1
0
Fork 0
mirror of https://github.com/thoughtbot/shoulda-matchers.git synced 2022-11-09 12:01:38 -05:00
thoughtbot--shoulda-matchers/spec/support/tests/database.rb
Elliot Winkler 72f60fae94 Add support for Postgres
When running tests, you can now switch between running them against a
SQLite or PostgreSQL database. This is accomplished by modifying the
unit and acceptance tests so that when they generate and load the test
Rails application, database.yml is replaced with content that will
configure the database appropriately.
2015-02-12 16:01:00 -07:00

28 lines
483 B
Ruby

require_relative 'database_configuration'
module Tests
class Database
NAME = 'shoulda-matchers-test'
ADAPTER_NAME = ENV.fetch('DATABASE_ADAPTER', 'sqlite3').to_sym
include Singleton
attr_reader :config
def initialize
@config = Tests::DatabaseConfiguration.for(NAME, ADAPTER_NAME)
end
def name
config.database
end
def adapter_name
config.adapter
end
def adapter_class
config.adapter_class
end
end
end