<br><br><div><span class="gmail_quote">On 26/02/2008, <b class="gmail_sendername">David Chelimsky</b> <<a href="mailto:dchelimsky@gmail.com">dchelimsky@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Tue, Feb 26, 2008 at 7:39 AM, Max Williams<br> <<a href="mailto:toastkid.williams@gmail.com">toastkid.williams@gmail.com</a>> wrote:<br><br> <br> This does not happen for you implicitly when you use before(:all)<br>
because there is no mechanism for running a group of examples in a<br> transaction.</blockquote><div><br>ah...i see. I didn't know about that last bit. :)<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
> My problem, though, is that the data is left over from the last time (in<br> > fact all previous times) that i ran the spec file, where i thought that it<br> > was cleared out. Do i need to explicitly tell the database to clear all the<br>
> records in an 'after' block?<br> <br> <br>Yes. If you want to use before(:all) to set up data, you need to use<br> after(:all) to clean it up explicitly.<br> <br> Please beware that this approach is extremely error prone over time.<br>
If you ever introduce a side effect (intentionally or accidentally)<br> that modifies the data, you're going to look at the spec, see the data<br> you're setting up and incorrectly think that that's the data every<br>
example is using. It is much, much safer (and more sane) to use<br> before(:each) even though it may slow things down a bit.</blockquote><div><br>Gotcha. Thanks! <br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
HTH,<br> <br>David<br> <br><br></blockquote></div><br>