[rspec-users] RSpec, RESTful nested routes and :path_prefix

Harm Aarts harm.aarts at innovationfactory.nl
Fri Nov 2 08:27:04 EDT 2007

Dear list,

In the app we are making we have a rout something like this:
map.resources :projects do |projects|
   projects.resources :pages, :controller  
=>"Wiki::Pages", :path_prefix => "/projects/:project_id/ 
wiki", :name_prefix => "project_wiki_"

But I can't get RSpec(I'm very new to it) to accept this. It keeps
throwing errors:
ActionController::RoutingError in 'Wiki::PagesController POST  
'create' should be successful'
No route matches {:action=>"create", :controller=>"wiki/ 
pages", :project_id=>1, :page => {}}

I get why it throws these errors but not how to fix it. The relavant
   it "GET 'create' should be successful" do
     post 'create', :project_id => 1, :page => {}
     response.should be_success

How do I modify the get request properly?
Thanks in advance!

More information about the rspec-users mailing list