Re: [rspec-users] Testing my rails authentication controller

2009-06-19 Thread powertoaster
David thank you, that worked great. I am doing this and am very happy with the result. Employee.stub(:authenticate).with(params[:username], params[:password]).and_return(nil) post :login, params session[:employee_id].should be_nil response.should redirect_to(:controller =>

Re: [rspec-users] Testing my rails authentication controller

2009-06-05 Thread David Chelimsky
On Fri, Jun 5, 2009 at 3:10 PM, Wayne Andersen wrote: > I have a simple controller: > > class AccessController < ApplicationController >   def login >     if request.post? >   employee = Employee.authenticate(params[:name], params[:password]) >   if employee >     session[:employee_id]

[rspec-users] Testing my rails authentication controller

2009-06-05 Thread Wayne Andersen
I have a simple controller: class AccessController < ApplicationController def login if request.post? employee = Employee.authenticate(params[:name], params[:password]) if employee session[:employee_id] = employee.id redirect_to(:controller => "timesheets