Skip to content

Instantly share code, notes, and snippets.

@entp
Created November 29, 2008 19:35
Show Gist options
  • Save entp/30293 to your computer and use it in GitHub Desktop.
Save entp/30293 to your computer and use it in GitHub Desktop.
module MyApp
class TestCase < Test::Unit::TestCase
def self.transaction(&block)
Sequel::Model.db.transaction &block
end
def transaction(&block)
self.class.transaction(&block)
end
def self.it(*args, &block)
test(*args) do
transaction do
instance_eval(&block)
raise Sequel::Error::Rollback
end
end
end
def self.cleanup(*models)
before :all do
models.each { |m| m.delete_all }
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment