On Dec 8, 3:01 pm, Clive Crous <[email protected]> wrote:
> 2009/12/9 Jeremy Evans <[email protected]>:
>
> > I use transactional unit tests in most of my apps, using RSpec:
>
> I still think this is a bad idea, nested transactions can cause very
> unexpected and even strange results. -- unless of course you never use
> transactions anywhere in your code - then of course there's no nesting
> ;)
>
> Unless you are intimately familiar with your database's implementation
> of transaction nesting or you don't use transactions ever in your own
> code ... well don't expect your code to behave as expected within this
> nesting. For example there are database nested-transaction
> implementations that don't make visible changes to the database until
> the OUTERMOST transaction closes.

You may be forgetting that Sequel never creates nested transactions/
savepoints unless you explicitly request it.  If you don't, it just
reuses the existing transaction.

There are some scenarios where it will break things:

  it "should swallow rollbacks" do
     proc{DB.transaction{raise Sequel::Rollback}}.should_not
raise_error
  end

But most code should be fine.

Jeremy

--

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.


Reply via email to