forked from cheald/mongomapper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_helper.rb
More file actions
29 lines (22 loc) · 710 Bytes
/
Copy pathtest_helper.rb
File metadata and controls
29 lines (22 loc) · 710 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require 'pathname'
require 'pp'
require 'rubygems'
require 'shoulda'
gem 'mocha', '0.9.4'
gem 'jnunemaker-matchy', '0.4.0'
require 'matchy'
require 'mocha'
require 'custom_matchers'
$LOAD_PATH.unshift(File.dirname(__FILE__))
dir = (Pathname(__FILE__).dirname + '..' + 'lib').expand_path
require dir + 'mongomapper'
class Test::Unit::TestCase
include CustomMatchers
def clear_all_collections
MongoMapper::Document.descendants.map { |d| d.collection.clear }
end
end
DefaultDatabase = 'test' unless defined?(DefaultDatabase)
AlternateDatabase = 'test2' unless defined?(AlternateDatabase)
MongoMapper.connection = Mongo::Connection.new('127.0.0.1', 27017)
MongoMapper.database = DefaultDatabase