Rspec / Capybara:如何“期望看到路由错误”?

达里尔·桑托斯(Daryll Santos)

如何告诉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] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章