Hi,

The RSpec Book (http://www.pragprog.com/titles/achbd/the-rspec-book) just added 
a new chapter about testing controllers, within which is an example of testing 
a before filter. You might find it of use.

Brandon

> -----Original Message-----
> From: [email protected] [mailto:rubyonrails-
> [email protected]] On Behalf Of Fernando Perez
> Sent: Thursday, April 16, 2009 10:40 AM
> To: [email protected]
> Subject: [Rails] Stubbing an ApplicationController before_filter
> 
> 
> Hi,
> 
> I am writing a functional test for a controller. The problem I have is
> that a before filter defined in ApplicationController is hit and I
> don't
> know how to stub it.
> 
> I tried controller.expects(:find_site).returns(@site) but it fails as
> controller is unknown method.
> 
> I tried ApplicationController.expects(:find_site).returns(@site) but
> the
> assertion fails as it never happens. So how do I deal with that?
> --
> Posted via http://www.ruby-forum.com/.
> 
> 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to