tag:www.rhnh.net,2008:/activemessagingActivemessaging - Xavier Shay's Blog2007-12-20T22:18:46ZEnkiXavier Shaynotreal@rhnh.nettag:www.rhnh.net,2008:Post/3362007-12-20T22:18:00Z2007-12-20T22:18:46ZTest setup broken in Rails 2.0.2<p>Some changes went into rails 2.0.2 that mean the <code>setup</code> method in test subclasses won’t get called. Here’s how it went down:</p>
<ul>
<li><a href="http://dev.rubyonrails.org/changeset/8392">8392</a> broke it</li>
<li><a href="http://dev.rubyonrails.org/changeset/8430">8430</a> tagged 2.0.2</li>
<li><a href="http://dev.rubyonrails.org/changeset/8442">8442</a> reverted 8392</li>
<li><a href="http://dev.rubyonrails.org/changeset/8445">8445</a> added a test so it doesn’t break again</li>
</ul>
<p>You can see some code illustrating the problem in 8445. This affects two plugins that we’re using – <a href="http://nubyonrails.com/articles/test-your-helpers">helper_test</a> and <a href="http://code.google.com/p/activemessaging/wiki/ActiveMessaging">activemessaging</a>.</p>
<p>For the helper test, the work around is to rename your helper test setup methods to <code>setup_with_fixtures</code>.</p><table class="CodeRay"><tr>
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>1<tt>
</tt>2<tt>
</tt>3<tt>
</tt></pre></td>
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }"><span class="r">def</span> <span class="fu">setup_with_fixtures</span><tt>
</tt> <span class="r">super</span><tt>
</tt><span class="r">end</span><tt>
</tt></pre></td>
</tr></table>
<p>For activemessaging, add the following line to the setup of your functionals that are failing (<a href="http://groups.google.com/group/activemessaging-discuss/browse_frm/thread/d0c7f025b2855463">from the mailing list</a>):</p><table class="CodeRay"><tr>
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>1<tt>
</tt></pre></td>
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }"><span class="co">ActiveMessaging</span>.reload_activemessaging<tt>
</tt></pre></td>
</tr></table>