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

2008-11-05 Thread David Chelimsky
On Wed, Nov 5, 2008 at 8:22 AM, Fernando Perez <[EMAIL PROTECTED]> wrote: > Thanks for the clarification. And from now on I will quote previous > emails. Sorry man, but I'm laughing my ass off over this. Readers of this email will have no idea what I clarified for you because you *didn't quote th

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

2008-11-05 Thread Fernando Perez
Thanks for the clarification. And from now on I will quote previous emails. -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

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

2008-11-05 Thread David Chelimsky
On Wed, Nov 5, 2008 at 8:06 AM, Fernando Perez <[EMAIL PROTECTED]> wrote: > Actually, in a before(:each) block, the stubbing works. So why doesn't > it work with a before(:all)? Please, please, please quote the information from the previous email to which you are referring. I'll respond to your fi

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

2008-11-05 Thread David Chelimsky
On Wed, Nov 5, 2008 at 8:05 AM, Fernando Perez <[EMAIL PROTECTED]> wrote: > I'm also having problems stubbing current_user. > > I cannot put > controller.stub!(:current_user).and_return(@current_user) > in a before(:all) block. The stubbing doesn't happen. Stubs and mocks get cleared out after ea

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

2008-11-05 Thread Fernando Perez
Actually, in a before(:each) block, the stubbing works. So why doesn't it work with a before(:all)? -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

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

2008-11-05 Thread Fernando Perez
I'm also having problems stubbing current_user. I cannot put controller.stub!(:current_user).and_return(@current_user) in a before(:all) block. The stubbing doesn't happen. However if I put it in the it "should..." block, then it works. Why is that? -- Posted via http://www.ruby-forum.com/. _

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

2008-04-15 Thread David Chelimsky
On Apr 15, 2008, at 7:08 PM, newbie wrote: >> Not sure why you are stubbing entries on the controller ... entries >> is >> called on the current user ... > > I have this method. I want to use this variable to loop the users > @entries. So I'm testing to see that this variable is tested and works

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

2008-04-15 Thread newbie
> Not sure why you are stubbing entries on the controller ... entries is > called on the current user ... I have this method. I want to use this variable to loop the users @entries. So I'm testing to see that this variable is tested and works correctly. def main @entries = current_user.entrie

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/

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-12 Thread newbie
Hey Jarkko, Thanks for the feedback. I tried your suggestion and it doesn't seem to 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" do it "should show all the current entries for the user" do

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

2008-04-11 Thread Jarkko Laine
On 11.4.2008, at 4.57, newbie wrote: Thanks for the direction. I'm glad to hear that I'm going in the right direction. I just have a final question and I seem to be hitting a stub/mocking road block at the moment. In my controller I have this... def index @entries = current_user.entries end H

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

2008-04-10 Thread newbie
Thanks for the direction. I'm glad to hear that I'm going in the right direction. I just have a final question and I seem to be hitting a stub/mocking road block at the moment. In my controller I have this... def index @entries = current_user.entries end How would I rspec this out correctly? This

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

2008-04-07 Thread Bryan Ray
Responses shown below... Sorry this isn't extremely informative ... in a bit of a rush. Hopefully it will point you in the appropriate direction. On Sun, Apr 6, 2008 at 2:17 PM, newbie <[EMAIL PROTECTED]> wrote: > I'm new to Rspec and I'm having a bit of trouble with this controller > that I'm t

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

2008-04-07 Thread newbie
I'm new to Rspec and I'm having a bit of trouble with this controller that I'm testing. I think I'm doing it right but I guess my syntax is wrong. I'm currently using the "acts_as_authenticated" plug in. What I want to test out is EventController on entering the tickets_page - should show the tic