[rspec-users] Testing a nested controller

Andreas Wolff rubyphunk at googlemail.com
Fri Sep 14 05:02:08 EDT 2007


Hey everyone.
I really stuck on testing a nested controller. I'm trying to make a
request using get and afterwards checking the response by
response.should ...

My routes.rb looks like this:

map.resources :writers do |writers|
 writers.resources :notes
end


In my notes_controller_spec.rb

def do_get
 writer_id = 1
 note_id = 1
 get note_path(writer_id, note_id)
end

it "should show a note" do
 do_get
 response.should be_success
end


But this always ends in an error message:
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.rewrite

Can anybody help here??

-- 
by(e)
Andreas Wolff


More information about the rspec-users mailing list