Sha256: 6a40db3e3d4b6fd38910622d34c7d8a16e7e1846ef55d1ea258d80d21c181702

Contents?: true

Size: 902 Bytes

Versions: 5

Compression:

Stored size: 902 Bytes

Contents

$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))

require 'minitest/spec'
require 'minitest/unit'
require 'swift'
require 'etc'

class MiniTest::Spec
  def self.supported_by *adapters, &block
    adapter_defaults    = { Swift::DB::Sqlite3 => { db: ':memory:' } }
    connection_defaults = { db: 'swift_test', user: Etc.getlogin, host: '127.0.0.1' }
    adapters.each do |adapter|
      begin
        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
        block.call(adapter)
      end
    end
  end
end

MiniTest::Unit.autorun

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
swift-0.10.0 test/helper.rb
swift-0.9.1 test/helper.rb
swift-0.9.0 test/helper.rb
swift-0.8.1 test/helper.rb
swift-0.8.0 test/helper.rb