sequel-rails
sequel-rails copied to clipboard
Transactional Unit Tests
With ActiveRecord missing, the transactional_fixtures feature must be disabled, but this has the side-effect of turning off transactions for unit tests.
I've searched for a method to re-engage this with no luck, so as an alternative I've created a quick work-around that wraps the test runner in a transaction that's rolled back:
http://gist.github.com/515753
For RSpec 2 this can be done by adding an around block...
around(:each) do |example|
Sequel::DATABASES.first.transaction do
example.run
raise Sequel::Error::Rollback
end
end