Sha256: 1473968e46757ebe7e97e38bf09736ed4d987d971dd9dc8b2631b51d46571931
Contents?: true
Size: 775 Bytes
Versions: 1
Compression:
Stored size: 775 Bytes
Contents
ENV['LOG_NAME'] = 'spec' require File.dirname(__FILE__) + '/../environment' # Define a fixtures helper method to load up our test data. def fixtures(name) entry = YAML::load_file(File.dirname(__FILE__) + "/fixtures/#{name}.yaml") klass = Kernel::const_get(Inflector.classify(Inflector.singularize(name))) database.logger.debug { "AUTOMIGRATE: #{klass}" } klass.auto_migrate! (entry.kind_of?(Array) ? entry : [entry]).each do |hash| if hash['type'] Object::const_get(hash['type'])::create(hash) else klass::create(hash) end end end # Pre-fill the database so non-destructive tests don't need to reload fixtures. Dir[File.dirname(__FILE__) + "/fixtures/*.yaml"].each do |path| fixtures(File::basename(path).sub(/\.yaml$/, '')) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
datamapper-0.2.3 | spec/spec_helper.rb |