Hey all,
I'm new to Rspec and I was just wondering what the standard way of
testing nested resources is?
I currently have a Job model which has many Correspondences.
The new action of my CorrespondencesController looks like:
def new
@job = Job.find params[:job_id]
@correspondence = @job.correspondences.build
end
And my current spec looks like:
it "GET new" do
@job = stub_model(Job, :to_param => "1")
Job.should_receive(:find).and_return(@job)
get :new, :job_id => @job.id
assigns[:correspondence].should_not be_nil
end
The test is currently failing with correspondence is nil, but it works
fine in the browser.
Any help here would be great, thanks.
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users