[rspec-users] Testing misc methods in ApplicationController

Max Williams toastkid.williams at gmail.com
Fri Feb 22 08:26:40 EST 2008

I'm already successfully testing before_filters in application_controller
courtesy of this blog post:

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?

eg if i have this empty method in application_controller

def  andreplace(str)

and my spec looks like this:

describe ApplicationController do
  describe "andreplace(str)" do
     it "should format ands for ferret search" do
       andreplace("foo and bar").should eql("+foo +bar")

Currently, the test breaks, saying:
NoMethodError in 'ApplicationController andreplace(str) should format ands
for ferret search'
undefined method `andreplace' for

What's going wrong here, anyone know?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080222/a5ae09d4/attachment.html 

More information about the rspec-users mailing list