Skip to content

Instantly share code, notes, and snippets.

@reactormonk
Created February 17, 2010 20:13
Show Gist options
  • Select an option

  • Save reactormonk/306975 to your computer and use it in GitHub Desktop.

Select an option

Save reactormonk/306975 to your computer and use it in GitHub Desktop.
BareTest.new_component :datamapper do
require 'dm-core'
DataMapper.auto_migrate!
setup do
DataMapper.repository do |r|
transaction = DataMapper::Transaction.new(r)
transaction.begin
r.adapter.push_transaction(transaction)
end
end
teardown do
DataMapper.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