Hi Jeremy, Thanks for the quick response. I'm following your advice and using transactions to rollback with each test invocation by overriding MiniTest::Unit::TestCase#run, as shown in the testing document you linked to. However, in MiniTest the return value of that method is important. I created a pull request to update the documentation:
https://github.com/jeremyevans/sequel/pull/521 -- Michael Jackson @mjackson On Tue, Jul 17, 2012 at 10:33 AM, Jeremy Evans <[email protected]>wrote: > On Tuesday, July 17, 2012 8:55:48 AM UTC-7, mjackson wrote: >> >> Thanks for the suggestion Jeremy. Is it a bad idea to use >> Database#begin_transaction and Database#rollback_transaction independently? >> Since I'm using this feature for testing, it would be nice to call >> begin_transaction in my setup and rollback_transaction in my teardown >> instead of using the Database#transaction method with a block. > > > Calling the private methods is unsupported, but other users here have done > it successfully (see > https://groups.google.com/d/topic/sequel-talk/VjfJcTD6s3w/discussion). > It is difficult to get correct error handling with a non-block based API. > The block-based API handles errors correctly, and I don't want to support a > non-block based transaction API, since it would be misused, people would > report bugs, and I don't want to deal with that. That being said, this is > ruby, we're all adults, feel free to use the private methods, just don't > expect support. > > The recommended solution is to use the block-based API. If you are using > a testing library that doesn't support block-based usage, switch to one > that does, or modify the library appropriately. Examples of this for > common testing frameworks are in > http://sequel.rubyforge.org/rdoc/files/doc/testing_rdoc.html, so review > that if you haven't already. > > > Thanks, > Jeremy > > -- > You received this message because you are subscribed to the Google Groups > "sequel-talk" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/sequel-talk/-/XCh7faKMDhIJ. > > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/sequel-talk?hl=en. > -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.
