[rspec-users] proxy associantion on controllers

David Chelimsky dchelimsky at gmail.com
Fri Dec 5 09:16:55 EST 2008


On Fri, Dec 5, 2008 at 8:07 AM, Daniel Lopes <danielvlopes at gmail.com> wrote:
> Thanks Newman, I already try this but get strange error:
>   before do
>     @current_user = mock_model(User, :id => 1)
>     controller.stub!(:check_administrator_role).and_return(true)
>     User.stub(:find).with(1).and_return(@user) # <=<=<=<=<=<=

It's stub!, not stub :)

Cheers,
David

>   end
> The error:
> undefined method `stub' for #<Class:0x23a5f3c>
>
> Atenciosamente,
>
> Daniel Lopes    Area Criações
> Design, Websites e Sistemas Web
>
> Visite:  http://www.areacriacoes.com.br/projects
>           http://blog.areacriacoes.com.br/
>
> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> *
> 55 (31) 3077-4560  /  55 (31) 8808-8748  /  55 (31) 8737-7501
>
>
> On Fri, Dec 5, 2008 at 11:58 AM, Newman Huang <lists at ruby-forum.com> wrote:
>>
>> try:
>>
>> #@user = User.find(params[:user_id])
>> User.stub(:find).with(xx).and_return(@user)
>> --
>> Posted via http://www.ruby-forum.com/.
>> _______________________________________________
>> rspec-users mailing list
>> rspec-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users
>
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list