Sha256: 5f6e7a46404832a567951cccd6e61258f2462dddf9dec4074f3e2f10bd667fed
Contents?: true
Size: 1.42 KB
Versions: 4
Compression:
Stored size: 1.42 KB
Contents
require 'pathname' require 'rubygems' require 'spec' require 'dm-core' require 'dm-migrations' SPEC_ROOT = Pathname(__FILE__).dirname.expand_path require SPEC_ROOT.parent / 'lib' / 'dm-ambition' Pathname.glob((SPEC_ROOT / '{lib,*/shared}/**/*.rb').to_s).each { |f| require f } def load_driver(name, default_uri) return false if ENV['ADAPTER'] != name.to_s begin DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri) DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name] true rescue LoadError => e warn "Could not load do_#{name}: #{e}" false end end ENV['ADAPTER'] ||= 'sqlite3' HAS_SQLITE3 = load_driver(:sqlite3, 'sqlite3::memory:') HAS_MYSQL = load_driver(:mysql, 'mysql://localhost/dm_core_test') HAS_POSTGRES = load_driver(:postgres, 'postgres://postgres@localhost/dm_core_test') Spec::Runner.configure do |config| config.after :all do # global model cleanup descendants = DataMapper::Model.descendants.to_a while model = descendants.shift descendants.concat(model.descendants.to_a - [ model ]) parts = model.name.split('::') constant_name = parts.pop.to_sym base = parts.empty? ? Object : Object.full_const_get(parts.join('::')) if base.const_defined?(constant_name) base.send(:remove_const, constant_name) end DataMapper::Model.descendants.delete(model) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
dm-ambition-1.0.0 | spec/spec_helper.rb |
dm-ambition-1.0.0.rc3 | spec/spec_helper.rb |
dm-ambition-1.0.0.rc2 | spec/spec_helper.rb |
dm-ambition-1.0.0.rc1 | spec/spec_helper.rb |