Skip to content

Instantly share code, notes, and snippets.

@probablykabari
Forked from snusnu/transactional_specs.rb
Created February 16, 2010 16:19
Show Gist options
  • Save probablykabari/305634 to your computer and use it in GitHub Desktop.
Save probablykabari/305634 to your computer and use it in GitHub Desktop.
Spec::Runner.configure do |config|
config.before do
repository do |r|
transaction = DataMapper::Transaction.new(r)
transaction.begin
r.adapter.push_transaction(transaction)
end
end
config.after do
repository do |r|
adapter = r.adapter
while adapter.current_transaction
adapter.current_transaction.rollback
adapter.pop_transaction
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment