[rspec-users] unexpected should_receive behaviour

2012-10-09 Thread enrico stano
Hi, surely I'm missing something... but what!? in my spec I've User.should_receive(:find).with("1").and_return(@user) and in my controller User.find(params[:id]) green light... correct... but if I change my controller using another method, for example first: User.first or even User.all I

Re: [rspec-users] unexpected should_receive behaviour

2012-10-09 Thread Ben Lovell
Hi, On 9 October 2012 13:04, enrico stano wrote: > Hi, > > surely I'm missing something... but what!? > > in my spec I've > > User.should_receive(:find).with("1").and_return(@user) > > and in my controller > > User.find(params[:id]) > > green light... correct... > > but if I change my controller

Re: [rspec-users] unexpected should_receive behaviour

2012-10-09 Thread enrico stano
Hi Ben, you could find more info browsing this Gist https://gist.github.com/3848429#file_user_controller_spec.rb I've added it to my StackOverflow question too. Thank you for your time! ennrico 2012/10/9 Ben Lovell : > Hi, > > On 9 October 2012 13:04, enrico stano wrote: >> >> Hi, >> >> surel

Re: [rspec-users] unexpected should_receive behaviour

2012-10-09 Thread enrico stano
Hi, I think we are on the right way on StackOverflow, #find is called twice: http://stackoverflow.com/questions/12799617/unexpected-rspec-should-receive-behaviour now all I need is to detect which method call the two #find. I think that the first is CanCan #authorize! and I know that the second

Re: [rspec-users] unexpected should_receive behaviour

2012-10-09 Thread Ben Lovell
On 9 October 2012 13:56, enrico stano wrote: > Hi Ben, > > you could find more info browsing this Gist > https://gist.github.com/3848429#file_user_controller_spec.rb > > I've added it to my StackOverflow question too. > > Thank you for your time! > > ennrico > > CanCan is finding your user record

Re: [rspec-users] unexpected should_receive behaviour

2012-10-09 Thread Andy Lindeman
On Tue, Oct 9, 2012 at 8:56 AM, enrico stano wrote: > Hi Ben, > > you could find more info browsing this Gist > https://gist.github.com/3848429#file_user_controller_spec.rb > > I've added it to my StackOverflow question too. > > Thank you for your time! It's likely that cancan is calling User.fin

Re: [rspec-users] unexpected should_receive behaviour

2012-10-09 Thread enrico stano
yes, it's CanCan fault! ;) any chance to check something like that (pseudo code) ? User.should_receive(:find).with("1").called_by(User.authorize!) User.should_receive(:find).with("1").called_by(controller) just to check exactly what's happening thank you! 2012/10/9 Andy Lindeman : > On Tue, O

Re: [rspec-users] unexpected should_receive behaviour

2012-10-09 Thread Ben Lovell
On 9 October 2012 14:46, enrico stano wrote: > yes, it's CanCan fault! ;) > > any chance to check something like that (pseudo code) ? > > User.should_receive(:find).with("1").called_by(User.authorize!) > User.should_receive(:find).with("1").called_by(controller) > > just to check exactly what's h

Re: [rspec-users] unexpected should_receive behaviour

2012-10-09 Thread enrico stano
ok, thank you very much for your time! bye, enrico On Tuesday, October 9, 2012, Ben Lovell wrote: > > On 9 October 2012 14:46, enrico stano 'cvml', 'enrico...@gmail.com');> > > wrote: > >> yes, it's CanCan fault! ;) >> >> any chance to check something like that (pseudo code) ? >> >> User.shoul