[rspec-users] Trouble defining a stub method for a controller

Gaston Ramos gramos at rectorado.unl.edu.ar
Tue May 29 14:42:22 EDT 2007

El mar, 29 de may de 2007, a las 01:42:04 -0400, Aníbal Rojas dijo:
> Hello,
>     Not sure if I am doing something really wrong (let's not say
> stupid for now), but I haven't been able to stub a controller method
> like:
>      controller.stub!(:logged_in?).and_return(true)
>      Please help, this is driving me nuts ;-)

I have this, and works ok! try it:

describe PersonController do

  before(:each) do
    @person = mock("person")


  it "create should be redirect list at finish" do
    get 'create'
    response.should redirect_to(:action => 'list')

> -- 
> Aníbal Rojas
> http://www.rubycorner.com
> http://www.hasmanydevelopers.com
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

Gastón Ramos

"I always thought Smalltalk would beat Java, I just didn't know it would be
called 'Ruby' when it did."
 -- Kent Beck

More information about the rspec-users mailing list