How do I tell RSpec/Capybara to expect a RoutingError? The reason is I want users to click a link to "claim a plate" via PUT, not via GET/visiting the path.
Basically I want to 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
Try this
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With