[rspec-users] proxy associantion on controllers

Daniel Lopes danielvlopes at gmail.com
Fri Dec 5 09:07:37 EST 2008


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) # <=<=<=<=<=<=
  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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081205/2b3bfcab/attachment.html>


More information about the rspec-users mailing list