Hi, I released a gem to test after_commit hooks when doing transaction tests, mind you it only works on Sequel >= 5.0. You can find it here: https://github.com/pabloh/sequel-force-hooks
Cheers El domingo, 2 de febrero de 2014 a la(s) 03:36:42 UTC-3, Sean West escribió: > I'm utilizing the after_commit hook to run some background jobs and it is > working great. I am running into problems with the tests though as each > test is transactional and triggering a rollback, so after_commit is never > called. > > I am using Test::Unit for my tests with the run method overridden as > suggested by the 'Testing with Sequel' document: > > http://sequel.jeremyevans.net/rdoc/files/doc/testing_rdoc.html > > class SequelTestCase < Test::Unit::TestCase > def run(*args, &block) > result = nil > Sequel::Model.db.transaction(:rollback=>:always){result = super} > result > endend > > > What is the best way to ensure that the after_commit hooks are called when > running the tests? I imagine others have run into this problem before as > well, however I can't find any clues out there for Sequel. Is there > something simple I'm missing? > > I'm currently hacking my way around it by simply calling the after_commit > method directly from my test. > > Using Sequel 4.6.0 > > Thanks! > > - Sean > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/sequel-talk/b0fa6387-1fad-4f5b-a788-67477232ed6en%40googlegroups.com.
