On Fri, Dec 5, 2008 at 8:07 AM, Daniel Lopes <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> wrote: >> >> try: >> >> [EMAIL PROTECTED] = 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@rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users