Skip to content

Instantly share code, notes, and snippets.

@jpr5
Created December 17, 2010 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpr5/745794 to your computer and use it in GitHub Desktop.
Save jpr5/745794 to your computer and use it in GitHub Desktop.
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