I can explain.
On my routes I have this:
resources :questions, :path => 'pq', only: [:index, :show, :create] do
#many other routes...
member do
post :up_vote, action: :vote, vote: 1
post :down_vote, action: :vote, vote: -1
end
end
You can observe, it has two routes for the same action, but send a param 'vote' for both.
I tried test with rspec using:
before{ post :up_vote, id: 1 }
Or
before{ post :vote, id: 1, vote: 1 }
But I haven't no success, always returns No routes matches
Anyone know how can I test with rspec it?
删除resources
行上的only
条款并重新测试。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.