Created
December 17, 2010 22:10
-
-
Save jpr5/745794 to your computer and use it in GitHub Desktop.
Nested-Transactional Cukes in DataMapper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Depends on: | |
- https://github.com/datamapper/do/commit/74645c46ac9b210c5e4029853b8a23fe02defd71 | |
- https://github.com/datamapper/dm-transactions/commit/242e60473a341a151df62ea707264f06f418b077 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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