[rspec-users] Authenticating before tests

Luke Galea galeal_lists at ideaforge.org
Thu Sep 13 08:25:21 EDT 2007

Hi all,

I'm using Goldberg, an engine that provides roles based access  
control for my app. I need to login before I can do controller tests,  
but I can't find any examples of people doing this.

Could someone point me in the right direction?

I thought the simplest way would be to either call the login action  
from my other tests before(:all), but I can't seem to find how to  
call another controller from within the spec for a different  
controller. (Results in @controller is nil).

I've also tried setting session[:user] in before(:all), but session  
is nil at that point!

Any help would be greatly appreciated.


More information about the rspec-users mailing list