[rspec-users] Help with nested routes test in Rails 3

Lalish-Menagh, Trevor trev at trevreport.org
Sat Jul 3 02:40:20 EDT 2010

Hi all,

I must be doing something wrong here. Could someone point me in the
right direction? I am trying to test my nested resources in Rails 3.

The route:
  resources :students do
    resources :days

The test:
      it "recognizes and generates #index" do
        { :get => "/students/1/days" }.should route_to(:controller =>
"days", :action => "index", :student_id => "1")

The error:
1) DaysController routing nested in students recognizes and generates #index
    Failure/Error: { :get => "/students/1/days" }.should
route_to(:student_id => "1", :controller => "days", :action =>
    found extras <{:student_id=>"1"}>, not <{}>

The route works find in the browser, I just don't know what I am
missing to make the test pass.

Trevor Lalish-Menagh
484.868.6150 mobile
trev at trevreport.org

More information about the rspec-users mailing list