如何告诉RSpec / Capybara遇到RoutingError?原因是我希望用户单击链接以通过PUT(而不是通过GET /访问路径)“声明标牌”。
基本上我想expect ActionController::RoutingError: No route matches [GET] "/plates/claim/1"
。
scenario 'they have to click the claim link' do
create_plates
sign_in_as_doctor
visit claim_plate_path(@plates.first.id)
?????
end
尝试这个
scenario 'they have to click the claim link' do
create_plates
sign_in_as_doctor
expect{visit claim_plate_path(@plates.first.id)}.to raise_error( ActionController::RoutingError)
end
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句