Re: [rspec-users] Setting instance variables for controllers

2008-09-03 Thread patrick_r
Thank you very much for all your help, this made everything crystal clear! -- View this message in context: http://www.nabble.com/Setting-instance-variables-for-controllers-tp19283500p19295990.html Sent from the rspec-users mailing list archive at Nabble.com. __

Re: [rspec-users] Setting instance variables for controllers

2008-09-03 Thread Jonathan Linowes
On Sep 3, 2008, at 10:53 AM, Scott Taylor wrote: On Sep 3, 2008, at 10:40 AM, Maurício Linhares wrote: You don't need to set the instance variable, you can stub the find call: Or you could also stub the call to User::find. Also - you don't *WANT* to set the instance variable - it's an

Re: [rspec-users] Setting instance variables for controllers

2008-09-03 Thread Scott Taylor
On Sep 3, 2008, at 10:40 AM, Maurício Linhares wrote: You don't need to set the instance variable, you can stub the find call: Or you could also stub the call to User::find. Also - you don't *WANT* to set the instance variable - it's an encapsulation violation - there is nothing in the p

Re: [rspec-users] Setting instance variables for controllers

2008-09-03 Thread Maurício Linhares
You don't need to set the instance variable, you can stub the find call: describe CartController do describe "index" do before do @user = mock_model( User ) end it "should render 'cart_full' if @user is set" do # This is where I need to set @user User.stub!( :find ).with('

[rspec-users] Setting instance variables for controllers

2008-09-03 Thread patrick_r
Hi everyone, I have been trying to find an answer to this question and have not been able to. Any help is greatly appreciated. I am using Rails 2.1.0 and Rspec 1.1.4. How can I set an instance variable in my Rspec test that is then available to my controller while the test is running? For examp