On 9/7/07, <b class="gmail_sendername">Pat Maddox</b> &lt;<a href="mailto:pergesu@gmail.com">pergesu@gmail.com</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
describe MyModel, &quot; when saved twice&quot; do<br></blockquote></div><br>This is the key point I hadn&#39;t considered; makes sense, as long as you make sure that there&#39;s a context wherein the specification that it should have a certain number of revisions.&nbsp; Thanks!
<br><br>Realized this afternoon that I need to use finer-grained &#39;test methods&#39; than I&#39;m used to.&nbsp; In some ways the it blocks are closer to assertions than to test methods in Test::Unit, in some ways.&nbsp; So I went from my first crack, closer to:
<br><br>describe Customer, &quot;xml&quot; do<br>&nbsp; before do<br>&nbsp;&nbsp;&nbsp; # set up customer<br>&nbsp; end<br><br>&nbsp; it &quot;should generate valid summary xml&quot; do<br>&nbsp;&nbsp;&nbsp; # generate summary xml<br>&nbsp;&nbsp;&nbsp; # a bunch of shoulds&nbsp; about the xml
<br>&nbsp; end<br><br>&nbsp; it &quot;should generate valid full xml&quot; do<br>&nbsp;&nbsp;&nbsp; # generate full xml<br>&nbsp;&nbsp;&nbsp; # a bunch of shoulds<br>&nbsp; end<br>end<br><br>To something like this:<br>describe Customer, &quot;full xml&quot; do<br>
&nbsp; before do<br>
&nbsp;&nbsp;&nbsp; # set up customer full xml<br>
&nbsp; end<br>
<br>
&nbsp; it &quot;should have a root node of customer&quot; do<br>&nbsp;&nbsp;&nbsp; @doc.root.name.should == &#39;customer&#39;<br>
&nbsp; end<br>
<br>
&nbsp; it &quot;should contain a customer id&quot; <br>&nbsp; it &quot;should have a name and address&quot;<br><br>&nbsp; #etc<br>
end<br><br>describe Customer, &quot;summary xml&quot; do<br>&nbsp; # etc.<br>end<br>
<br>So I guess I&#39;m still learning the mindset in places.&nbsp; Although you could ahve test methods like that in Test::Unit, most of the time you wouldn&#39;t bother simply because of the shared setup.&nbsp; But when the blocks affect how the spec is described, it&#39;s far more important to have fine-grained elements, I think.
<br><br>Actually, on that note -- what&#39;s the normal way to share a setup across multiple behaviors, a helper method in an includeable module?<br><br>So, thanks for the guidance.<br>