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

Nola Stowe mrnicksgirl at gmail.com
Fri Nov 2 19:56:22 EDT 2007

I had a problem when I used:

script/generate rspec_scaffold "admin/users"

it created the specs with the controller name is "admin_user" instead
of "admin/user" which I think should be correct.  So I had to go
through all the rspec generated files and change the _ to /

did you use rspec_scaffolding?

I don't know if this is the same issue, I would have to see more of
your spec file.

On 11/2/07, Harm Aarts <harm.aarts at innovationfactory.nl> wrote:
> 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_"
> end
> 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
> RSpec:
>    it "GET 'create' should be successful" do
>      post 'create', :project_id => 1, :page => {}
>      response.should be_success
>    end
> How do I modify the get request properly?
> Thanks in advance!
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

http://rubygeek.com - my blog featuring: Ruby, PHP and Perl
http://DevChix.com - boys can't have all the fun

More information about the rspec-users mailing list