doh...dammit, i thought i&#39;d tried that.&nbsp; I&#39;m losing it...<br><br>thanks!<br><br><div><span class="gmail_quote">On 22/02/2008, <b class="gmail_sendername">David Chelimsky</b> &lt;<a href="mailto:dchelimsky@gmail.com">dchelimsky@gmail.com</a>&gt; 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 Fri, Feb 22, 2008 at 7:26 AM, Max Williams<br> &lt;<a href="mailto:toastkid.williams@gmail.com">toastkid.williams@gmail.com</a>&gt; wrote:<br> &gt; I&#39;m already successfully testing before_filters in application_controller<br>
 &gt; courtesy of this blog post:<br> &gt; <a href="http://www.movesonrails.com/articles/2008/01/23/spec-ing-your-application-controller">http://www.movesonrails.com/articles/2008/01/23/spec-ing-your-application-controller</a><br>
 &gt;<br> &gt; However, i can;&#39;t work out how to test the sort of method that is added to<br> &gt; application_controller so that all controllers can use it.&nbsp;&nbsp;It must be<br> &gt; something simple that i&#39;m doing wrong/omitting, can anyone help?<br>
 &gt;<br> &gt; eg if i have this empty method in application_controller<br> &gt;<br> &gt; def&nbsp;&nbsp;andreplace(str)<br> &gt; end<br> &gt;<br> &gt; and my spec looks like this:<br> &gt;<br> &gt; describe ApplicationController do<br>
 &gt;&nbsp;&nbsp; describe &quot;andreplace(str)&quot; do<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; it &quot;should format ands for ferret search&quot; do<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;andreplace(&quot;foo and bar&quot;).should eql(&quot;+foo +bar&quot;)<br> <br> <br>Try this:<br>
 <br> controller.andreplace(&quot;foo and bar&quot;).should eql(&quot;+foo +bar&quot;)<br> <br><br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br> &gt;&nbsp;&nbsp; end<br> &gt; end<br> &gt;<br> &gt; Currently, the test breaks, saying:<br> &gt; NoMethodError in &#39;ApplicationController andreplace(str) should format ands<br>
 &gt; for ferret search&#39;<br> &gt;&nbsp;&nbsp;undefined method `andreplace&#39; for<br> &gt; #&lt;Spec::Rails::Example::ControllerExampleGroup::Subclass_1::Subclass_1:0xb64f7160&gt;<br> <br> <br>This is a pointer to the problem - the error is telling you that the<br>
 #andreplace message is going to the ExampleGroup, not the controller.<br> <br> HTH,<br> David<br> <br><br> &gt;<br> &gt;<br> &gt; What&#39;s going wrong here, anyone know?<br> &gt;<br> &gt;<br> <br>&gt; _______________________________________________<br>
 &gt;&nbsp;&nbsp;rspec-users mailing list<br> &gt;&nbsp;&nbsp;<a href="mailto:rspec-users@rubyforge.org">rspec-users@rubyforge.org</a><br> &gt;&nbsp;&nbsp;<a href="http://rubyforge.org/mailman/listinfo/rspec-users">http://rubyforge.org/mailman/listinfo/rspec-users</a><br>
 &gt;<br> _______________________________________________<br> rspec-users mailing list<br> <a href="mailto:rspec-users@rubyforge.org">rspec-users@rubyforge.org</a><br> <a href="http://rubyforge.org/mailman/listinfo/rspec-users">http://rubyforge.org/mailman/listinfo/rspec-users</a><br>
 </blockquote></div><br>