我的路线看起来像这样
resources :stores, :except => [:destroy] do
resources :toys, :member => {:destroy => :delete}
end
我的对象控制器规范看起来像这样
require 'spec_helper'
describe ToysController do
describe "GET index" do
it "assigns all toys as @toys" do
toy11 = Factory(:toy, :is_shiny => true)
toy12 = Factory(:toy,:is_shiny => false)
get :index
assigns(:toys).should eq([toy12,toy11 ])
end
end
end
end
我收到以下错误
Failure/Error: get :index
ActionController::RoutingError:
No route matches {:controller=>"toys"}
由于玩具资源嵌套在商店资源下,因此无法获得 Toys_path 路由,因此我认为规范失败。
我如何通过规范?
谢谢