Sha256: a8f7c28ed14d4ab3e1ffd8e41edbe683ed4fef6e317d3783716fd496fe4b2092

Contents?: true

Size: 926 Bytes

Versions: 2

Compression:

Stored size: 926 Bytes

Contents

require 'rubygems'
require 'bundler'
Bundler.setup

# TODO: Need better solution
if rand > 0.5
  puts 'Mongoid'
  require 'mongoid'
  models_folder = File.join(File.dirname(__FILE__), 'mongoid/models')
  Mongoid.configure do |config|
    name = 'voteable_mongo_test'
    host = 'localhost'
    config.master = Mongo::Connection.new.db(name)
    config.autocreate_indexes = true
  end
else
  puts 'MongoMapper'
  require 'mongo_mapper'
  models_folder = File.join(File.dirname(__FILE__), 'mongo_mapper/models')
  MongoMapper.database = 'voteable_mongo_test'
end


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


require 'voteable_mongo'
require 'rspec'
require 'rspec/autorun'

Dir[ File.join(models_folder, '*.rb') ].each { |file|
  require file
  file_name = File.basename(file).sub('.rb', '')
  klass = file_name.classify.constantize
  klass.collection.drop
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
voteable_mongo-0.9.3 spec/spec_helper.rb
voteable_mongo-0.9.2 spec/spec_helper.rb