Sha256: 9d6a338be229c730f0a78caa6540b3276bfed62d823312a6e6f285f0b480822a

Contents?: true

Size: 1.26 KB

Versions: 13

Compression:

Stored size: 1.26 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../lib/mongo_mapper')

gem 'jnunemaker-matchy', '0.4.0'
gem 'shoulda', '2.10.2'
gem 'timecop', '0.3.1'
gem 'mocha', '0.9.8'

require 'matchy'
require 'shoulda'
require 'timecop'
require 'mocha'
require 'pp'

require 'support/custom_matchers'
require 'support/timing'

class Test::Unit::TestCase
  include CustomMatchers

  def Doc(name=nil, &block)
    klass = Class.new do
      include MongoMapper::Document
      set_collection_name "test#{rand(20)}"

      if name
        class_eval "def self.name; '#{name}' end"
        class_eval "def self.to_s; '#{name}' end"
      end
    end

    klass.class_eval(&block) if block_given?
    klass.collection.remove
    klass
  end

  def EDoc(name=nil, &block)
    klass = Class.new do
      include MongoMapper::EmbeddedDocument

      if name
        class_eval "def self.name; '#{name}' end"
        class_eval "def self.to_s; '#{name}' end"
      end
    end

    klass.class_eval(&block) if block_given?
    klass
  end
end

test_dir = File.expand_path(File.dirname(__FILE__) + '/../tmp')
FileUtils.mkdir_p(test_dir) unless File.exist?(test_dir)

MongoMapper.connection = Mongo::Connection.new('127.0.0.1', 27017, {:logger => Logger.new(test_dir + '/test.log')})
MongoMapper.database = 'test'

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
mongo_mapper-unstable-2010.2.8 test/test_helper.rb
mongo_mapper-unstable-2010.2.5 test/test_helper.rb
mongo_mapper-unstable-2010.2.4 test/test_helper.rb
novelys_mongo_mapper-0.6.12 test/test_helper.rb
novelys_mongo_mapper-0.6.11 test/test_helper.rb
mongo_mapper-unstable-2010.2.3 test/test_helper.rb
novelys_mongo_mapper-0.6.10 test/test_helper.rb
mongo_mapper-unstable-2010.2.2 test/test_helper.rb
mongo_mapper-unstable-2010.2.1 test/test_helper.rb
mongo_mapper-unstable-2010.1.31 test/test_helper.rb
mongo_mapper-unstable-2010.1.30 test/test_helper.rb
mongo_mapper-unstable-2010.1.29 test/test_helper.rb
mongo_mapper-unstable-2010.1.28 test/test_helper.rb