doh...dammit, i thought i'd tried that. I'm losing it... thanks!
On 22/02/2008, David Chelimsky <[EMAIL PROTECTED]> wrote: > > On Fri, Feb 22, 2008 at 7:26 AM, Max Williams > <[EMAIL PROTECTED]> wrote: > > I'm already successfully testing before_filters in > application_controller > > courtesy of this blog post: > > > http://www.movesonrails.com/articles/2008/01/23/spec-ing-your-application-controller > > > > 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) > > end > > > > 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") > > > Try this: > > controller.andreplace("foo and bar").should eql("+foo +bar") > > > > end > > end > > end > > > > Currently, the test breaks, saying: > > NoMethodError in 'ApplicationController andreplace(str) should format > ands > > for ferret search' > > undefined method `andreplace' for > > > #<Spec::Rails::Example::ControllerExampleGroup::Subclass_1::Subclass_1:0xb64f7160> > > > This is a pointer to the problem - the error is telling you that the > #andreplace message is going to the ExampleGroup, not the controller. > > HTH, > David > > > > > > > > What's going wrong here, anyone know? > > > > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users@rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users