I was reading this section of the docs:
http://sequel.jeremyevans.net/rdoc/files/doc/testing_rdoc.html#label-Transactional+testing+with+savepoints
Which shows this example:
class Minitest::HooksSpec
def around
Sequel::Model.db.transaction(:rollback=>:always, :savepoint=>true,
:auto_savepoint=>true){super}
end
def around_all
Sequel::Model.db.transaction(:rollback=>:always){super}
end
end
So I jumped over to the RDoc for Sequel::Database#transaction to learn
about those options:
:auto_savepoint
Automatically use a savepoint for Database#transaction calls inside this
transaction block.
:savepoint
Whether to create a new savepoint for this transaction, only respected if
the database/adapter supports savepoints. By default Sequel will reuse an
existing transaction, so if you want to use a savepoint you must use this
option. If the surrounding transaction uses :auto_savepoint, you can set
this to false to not use a savepoint.
Based on my understand from the docs, shouldn't the Minitest example be:
class Minitest::HooksSpec
def around
Sequel::Model.db.transaction(:rollback=>:always){super}
end
def around_all
Sequel::Model.db.transaction(:rollback=>:always,
:auto_savepoint=>true){super}
end
end
The :auto_savepoint option in the around_all hook (which I believe wraps
the whole test suite) would ensure that the per-test transaction (in the
around hook) will use a savepoint, eliminating the need for
savepoint-related options there, right?
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.