rollback changes created by minitest unit test

I'm writing a test case in Minitest that creates a database entry. After the test is run, all changes that the test did should be rolled back. What is a good way to achieve this?

require 'minitest/autorun'
require 'rubygems'
require 'sequel'
require 'factory_girl'

class TestPostgresqlFunctions < MiniTest::Unit::TestCase
  def test_simple_function
    user = FactoryGirl.create(:user)

With this code, the created entry will stay in the database. I'm not using Rails or any other framework. The database I'm using is PostgreSQL 9.1.


This should work (requires Sequel 3.29.0 or greater):

# Use this class as the base class for your tests
class SequelTestCase < MiniTest::Unit::TestCase
  def run(*args, &block)

Need Your Help

In VBScript is there any way to get the fullpath to a file which can be present in any directory?

excel-vba vbscript wscript

Currently I am using hard-code PATH to a .EXCEL file in my Scripting language,Like as below:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.