Class: DatabaseCleaner::Sequel::Transaction

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/database_cleaner/sequel/transaction.rb

Instance Method Summary collapse

Methods included from Base

#db, #db=

Methods included from Generic::Base

#db, included

Instance Method Details

#cleanObject



19
20
21
22
# File 'lib/database_cleaner/sequel/transaction.rb', line 19

def clean
  f= @fibers.pop
  f.resume
end

#startObject



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/database_cleaner/sequel/transaction.rb', line 7

def start
  @fibers||= []
  db= self.db
  f= Fiber.new do
    db.transaction(:rollback => :always, :savepoint => true) do
      Fiber.yield
    end
  end
  f.resume
  @fibers<< f
end