require File.dirname(__FILE__) + '/../spec_helper' describe Sequel::Pervasive::DatabaseMethods do it "supports transactions" do set_fos_db([Trip]) t = Trip.first ### surround with begin/rescue begin ### testing do_transaction r = nil Trip.db.do_transaction do |conn| # increment the value of fs_visa by one r = conn.run(Trip.filter(t.pk_hash).update_sql(:fs_visa=>t.fs_visa.succ)) raise(Exception, 'testing do_transaction transactions') end ### end testing do_transaction rescue Exception => e ensure r.drop if r end # check if the values have changed Trip.first.fs_visa.should == t.fs_visa end end