Re: [rspec-users] testing controller instance variables

2009-07-17 Thread Rick DeNatale
On Fri, Jul 17, 2009 at 1:08 PM, Leo Godin wrote: > Thanks, > That works at least to the point where it is testing the variable. > However, it is calling it NIL.  How do I tell the test to make it be > 3? > > In the controller I have: > �...@num_found = @purchase_requests.size > > This is what I tr

Re: [rspec-users] testing controller instance variables

2009-07-17 Thread Leo Godin
Thanks, That works at least to the point where it is testing the variable. However, it is calling it NIL. How do I tell the test to make it be 3? In the controller I have: @num_found = @purchase_requests.size This is what I tried in the spec: it "should count the number of purchase requests

Re: [rspec-users] testing controller instance variables

2009-07-15 Thread Adam Anderson
you need to use the assigns method like so it "should count the number of purchase requests found" do get :index assigns(:num_found).should == 3 end On Wed, Jul 15, 2009 at 2:29 PM, Leo wrote: > HI All, > I have a controller with the following in it: > > def index >@purchase_reques

[rspec-users] testing controller instance variables

2009-07-15 Thread Leo
HI All, I have a controller with the following in it: def index @purchase_requests = PurchaseRequest.find(:all) @num_found = @purchase_requests.size end I want to test that @num_found is getting the number of purchase requests. This is what I've tried: it "should count the number