[rspec-users] map.with_options :path_prefix => '

Justin Rich jrich013 at gmail.com
Fri Aug 17 14:45:03 EDT 2007


I am getting a 'No route matches' error in rspec with routes that have a
path_prefix composed by map.with_options. Rails recognizes the routes just
fine and the site works, but I can't get the specs to pass unless I put the
prefix in each individual route. Any help is appreciated.

My foo model has a polymorphic owner which is what I want the path_prefix to
represent, so my routes.rb has something like...

   map.with_options :controller => 'foos', :path_prefix =>
':owner_type/:owner_id' do |foos|

     foos.new_foo '/foos/new',
                                :action => 'new'

     foos.create_foo '/foos',
                                   :action => 'create',
                                   :conditions => {:method => :post}


And in the foos_controller_spec.rb file is something like...

    describe FoosController, 'on a GET to new' do

      it "should make a baby foo" do
        # some stuff

        get 'new', :owner_type => 'client', :owner_id => '1'

        # shoulda's woulda's and coulda's


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070817/971ba700/attachment.html 

More information about the rspec-users mailing list