Skip to content

Instantly share code, notes, and snippets.

@jpr5
Created Dec 17, 2010
Embed
What would you like to do?
Nested-Transactional Cukes in DataMapper
Depends on:
- https://github.com/datamapper/do/commit/74645c46ac9b210c5e4029853b8a23fe02defd71
- https://github.com/datamapper/dm-transactions/commit/242e60473a341a151df62ea707264f06f418b077
known_repositories = ::DataMapper::Model.descendants.map { |m| m.repository }.uniq
Before do
known_repositories.each do |r|
t = r.transaction
t.begin
r.adapter.push_transaction(t)
end
end
After do
known_repositories.each do |r|
t = r.adapter.pop_transaction
t.rollback
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment