Hi, 

Since this extension is no longer compatible with Sequel 5.0 I released a 
new gem to replace it.
You can find it here: https://github.com/pabloh/sequel-force-hooks

Cheers

El viernes, 27 de mayo de 2016 a la(s) 16:42:34 UTC-3, Chris Hanks escribió:

> Hi y'all -
>
> I've put together a Sequel extension to support after_commit and 
> after_rollback hooks on savepoints. The most common use-case for this is in 
> transactional testing, so that you can do:
>
> Pseudocode example:
>
> # Test setup
> def around
>   # hooks: :savepoint makes after_commit and after_rollback callbacks 
> that are declared in savepoints
>   # run immediately after their savepoints commit or rollback, rather 
> than waiting for the entire
>   # transaction to commit or rollback.
>   DB.transaction(auto_savepoint: true, hooks: :savepoint, rollback: :
> always) { super }
> end
>
> it "should do something in an after_commit callback" do
>   # App logic:
>   DB.transaction do
>     DB.after_commit { do_something }
>   end
>   # do_something happens here, so specs can easily cover it.
>   # The Sequel default would be for it to never happen, since it would
>   # wait for the top-level transaction to complete, but it
>   # would always be rolled back.
>
>   assert do_something_happened
> end
> # As opposed to here, which is the Sequel default.
>
> The extension is here:
> https://github.com/chanks/sequel-savepoint-hooks
>
> It's dependent on some refactoring that I submitted to Sequel in PR #1198: 
> https://github.com/jeremyevans/sequel/pull/1198
>
> My question is, who else thinks this is useful enough to be included in 
> Sequel core? I personally use transactional testing almost exclusively, and 
> I want to be able to spec my after_commit blocks, so I think it's pretty 
> essential, but I'd like to hear what other people think.
>
> Chris
>

-- 
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/9c81bd5d-9ec0-4501-9557-63153b6cc7bdn%40googlegroups.com.

Reply via email to