Try this:
it "should render properly when getting /books/:id/prices" do
get "prices", :id => '0'
response.should be_success
end
Or even better (or what i think you wanted to do):
map.resources :books, :collection => { :prices => :get }
And your spec won't be changed.
On Thu, Jun 19, 2008 at 4:04 PM, Olivier Dupuis <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I'm creating a REST resource with the following map
>
> map.resources :books, :member => { :prices => :get }
>
> I would like to test the books controller
>
> class BooksController < ApplicationController
> def prices
> render :text => "Test"
> end
> end
>
> I have the following test
>
> it "should render properly when getting /books/:id/prices" do
> get "prices"
> response.should be_success
> end
>
> This is what I get
>
> ActionController::RoutingError in 'BooksController requesting
> /books/:id/prices
> using GET should render properly when getting /books/:id/prices'
> No route matches {:controller=>"books", :action=>"prices"}
> ./spec/controllers/books_controller_spec.rb:5:
>
> I've tried many different alternatives for get, but they always end up with
> the same error. I'm surely missing something. Any help would be
> appreciated.
>
> Thanks
>
> Olivier Dupuis
>
> _______________________________________________
> rspec-users mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/rspec-users
>
--
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)
João Pessoa, PB, +55 83 8867-7208
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users