[rspec-users] Testing routes

Olivier Dupuis olivierdupuis at gmail.com
Thu Jun 19 15:04:13 EDT 2008


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20080619/dc670b8d/attachment-0001.html>


More information about the rspec-users mailing list