-
Notifications
You must be signed in to change notification settings - Fork 28
/
datamapper.rb
36 lines (33 loc) · 928 Bytes
/
datamapper.rb
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
30
31
32
33
34
35
36
$main = self # This must be included in the env.rb file!
module Merb
module Test
module Helpers
module DataMapper
module ClassMethods
def use_transactional_fixtures
$main.Before do
repository(:default) do
transaction = ::DataMapper::Transaction.new(repository)
transaction.begin
repository.adapter.push_transaction(transaction)
end
end
$main.After do
repository(:default) do
while repository.adapter.current_transaction
repository.adapter.current_transaction.rollback
repository.adapter.pop_transaction
end
end
end
end
end
end
end
module World
module Base
extend Helpers::DataMapper::ClassMethods
end
end
end
end