Sha256: 7669d24e06fdb605ff06075e7b7515f9203b7647ad164f965c07ada09a4a84ce
Contents?: true
Size: 1.28 KB
Versions: 5
Compression:
Stored size: 1.28 KB
Contents
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $:.unshift(File.join(File.dirname(__FILE__), '..', 'test')) require 'bundler/setup' require 'etc' require 'minitest/autorun' require 'minitest_teardown_hack' require 'swift' require 'swift/adapter/mysql' require 'swift/adapter/postgres' require 'swift/adapter/sqlite3' require 'swift/migrations' class MiniTest::Spec def self.supported_by *adapters, &block adapter_defaults = { Swift::Adapter::Sqlite3 => { db: ':memory:' } } connection_defaults = { db: 'swift_test', user: Etc.getlogin, host: '127.0.0.1' } adapters.each do |adapter| begin #next if Swift::Adapter::Sqlite3 == adapter #next if Swift::Adapter::Mysql == adapter #next if Swift::Adapter::Postgres == adapter Swift.setup :default, adapter, connection_defaults.merge(adapter_defaults.fetch(adapter, {})) rescue => error warn "Unable to setup 'swift_test' db for #{adapter}, #{error.message}. Skipping..." next end describe("Adapter #{adapter.name}") do before do Swift.setup :default, adapter, connection_defaults.merge(adapter_defaults.fetch(adapter, {})) end after do Swift.db.close end block.call(adapter) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
swift-1.1.0 | test/helper.rb |
swift-1.0.3 | test/helper.rb |
swift-1.0.2 | test/helper.rb |
swift-1.0.1 | test/helper.rb |
swift-1.0.0 | test/helper.rb |