Re: [rspec-users] proxy associantion on controllers

2008-12-05 Thread Ashley Moran
On 5 Dec 2008, at 20:31, Daniel Lopes wrote: Ashley Moran gave me help in another post that I open by accident when entries in the group, and now spec passed... But I still would like to understand more about mocks and stubs that I asked in previous email. Yes I just noticed I re-answere

Re: [rspec-users] proxy associantion on controllers

2008-12-05 Thread Daniel Lopes
Thanks a lot Nick... No, i'm not using Authlogic because already have base project with restful_authentication implemented with activation, roles and etc... and when I look authlogic the project was young, I don't know now. About Martin Fowler post, I already readed... but the problem is because I

Re: [rspec-users] proxy associantion on controllers

2008-12-05 Thread Daniel Lopes
Ashley Moran gave me help in another post that I open by accident when entries in the group, and now spec passed... But I still would like to understand more about mocks and stubs that I asked in previous email. Thanks again and sorry many emails. Atenciosamente, Daniel Lopes  Area Criações D

Re: [rspec-users] proxy associantion on controllers

2008-12-05 Thread Nick Hoffman
On 2008-12-05, at 10:06, Daniel Lopes wrote: Thanks for help and sorry for insistance but I don't understand aspects on rspec ( I think not understand how we use mocks and stubs): Hi Daniel. If you're a bit unsure about when to use mocks vs stubs, have a read of this article by Martin Fowler

Re: [rspec-users] proxy associantion on controllers

2008-12-05 Thread Daniel Lopes
Thanks for help and sorry for insistance but I don't understand aspects on rspec ( I think not understand how we use mocks and stubs): The behavior of my controller is... Before Filter: check_administrator_role load_user So, in this case I want run my before filter methods in before block on rspec

Re: [rspec-users] proxy associantion on controllers

2008-12-05 Thread David Chelimsky
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_ret

Re: [rspec-users] proxy associantion on controllers

2008-12-05 Thread Joseph Wilk
Daniel Lopes 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) # <=<=<=<=<=<= Looks like a missing '!': User

Re: [rspec-users] proxy associantion on controllers

2008-12-05 Thread Daniel Lopes
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 # Atenci

Re: [rspec-users] proxy associantion on controllers

2008-12-05 Thread David Chelimsky
On Fri, Dec 5, 2008 at 7:58 AM, Newman Huang <[EMAIL PROTECTED]> wrote: > > try: > > [EMAIL PROTECTED] = User.find(params[:user_id]) > User.stub(:find).with(xx).and_return(@user) Please quote enough of the email to which you are responding to provide enough context so that those of us who read ema

Re: [rspec-users] proxy associantion on controllers

2008-12-05 Thread Newman Huang
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] proxy associantion on controllers

2008-12-05 Thread Daniel Area Criações
Hello, I'm trying learn Rspec but having problems to understand when and how user mocks and stubs. I have a properties_controller with to before_filter actions (check_administrator_role e load_user)... to access index action of properties_controller I need have a params[:user] and this parameter wi