Re: [rspec-users] Rspecing this simple controller it is driving me mad...

2008-04-13 Thread Jarkko Laine
On 12.4.2008, at 14.06, roberto belardo wrote: Uhm ok, i understood your answer but autotest did not. Better, this do not solves the problem. If i simply remove the "stub" and the "should_receive" for the author field, autotest will complain like this: Spec::Mocks::MockExpectationError in 'Com

Re: [rspec-users] how to stub the :current_user and any methods associated with it

2008-04-13 Thread Jarkko Laine
On 12.4.2008, at 22.24, newbie wrote: Hey Jarkko, Thanks for the feedback. I tried your suggestion and it doesn't seem to work. What doesn't work? To quickly recap I'm just testing in my controller that this works def index @entries = current_user.entries end describe "on the main page

Re: [rspec-users] how to stub the :current_user and any methods associated with it

2008-04-13 Thread Shane Mingins
Looking at yr earlier post ... controller.stub!(:entries).and_return(@entry) Not sure why you are stubbing entries on the controller ... entries is called on the current user ... I tend to do this ... @current_user = mock_model(User, :id => 1, :entries => [EMAIL PROTECTED]) HTH Shane On 13/