I'm already successfully testing before_filters in application_controller courtesy of this blog post: <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>
<br>However, i can;'t work out how to test the sort of method that is added to application_controller so that all controllers can use it. It must be something simple that i'm doing wrong/omitting, can anyone help?<br>
<br>eg if i have this empty method in application_controller<br><br>def andreplace(str)<br>end<br><br>and my spec looks like this:<br><br>describe ApplicationController do<br> describe "andreplace(str)" do<br>
it "should format ands for ferret search" do<br> andreplace("foo and bar").should eql("+foo +bar")<br> end<br> end<br>end<br><br>Currently, the test breaks, saying:<br>NoMethodError in 'ApplicationController andreplace(str) should format ands for ferret search'<br>
undefined method `andreplace' for #<Spec::Rails::Example::ControllerExampleGroup::Subclass_1::Subclass_1:0xb64f7160><br><br><br>What's going wrong here, anyone know?<br><br>