Have a job and a job has many pages. Setting that up for rspec was not as bad as I thought it was going to be
Here is the named route:
map.resources :jobs do |job|
job.resources :pages
end
Setting up the pages_controller_spec.rb was - after a bit of poking around - not too hard:
describe PagesController, " handling GET jobs/1/pages/1 for a job" do
before do
@job = mock_model(Job, {:id=>1})
@page = mock_model(Page)
Page.stub!(:find).and_return(@page)
Job.stub!(:find).and_return(@job)
end
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment