RSpecとCabybaraがいかにクールであるかを学び、実際のテストを書くことを学びました。RSpecとCapybara(Rails)によるテストリダイレクト
リンクをクリックした後に特定のページへのリダイレクトがあるかどうかを確認しようとしています。以下 はテストが
Failure/Error: assert_redirected_to "/projects/show" ArgumentError: @request must be an ActionDispatch::Request
以下のようなエラーメッセージで失敗したシナリオ
1) I have a page /projects/list - I have an anchor with html "Back" and it links to /projects/show Below is the test i wrote in rspec describe "Sample" do describe "GET /projects/list" do it "sample test" do visit "/projects/list" click_link "Back" assert_redirected_to "/projects/show" end end end
である私は、リダイレクトをテストする必要があり、私が間違って何をやっているどのように私を提案してください?
は' projects_path'を使うほうが良いでしょうか?そして、おそらく 'expect'表記を使用しているときには、 – SuckerForMayhem