一個創建路線我有這個天賦:rspec的針對資源
specify { expect(:post => admin_featured_path()).to route_to(:controller => 'admin/featured', :action => 'create')}
我不能」做不過它傳遞邏輯上似乎後的路由應該被路由到創建行動...
這是我的路線文件:
namespace :admin do
resources :featured, only: [:index, :update, :destroy, :create]
end
這是失敗消息:
1) Featured routes
Failure/Error: specify { expect(:post => admin_featured_path()).to route_to(:controller => 'admin/featured', :action => 'create')}
ActionController::UrlGenerationError:
No route matches {:action=>"update", :controller=>"admin/featured"} missing required keys: [:id]
# ./spec/routing/featured_spec.rb:7:in `block (2 levels) in <top (required)>'
{:後=> 「管理/功能」}工作,這不是{:post => admin_featured_path} ... – Boti
第二個是正確的答案 – Boti