Do routing specs support redirect routes? [RSpec]

前端 未结 5 1713
暗喜
暗喜 2021-02-05 02:49

After digging fairly deeply on this issue, I\'ve come to an impasse between my understanding of the documentation and my results.

According to https://www.relishapp.com/

5条回答
  •  悲哀的现实
    2021-02-05 03:26

    The simplest way to test external redirects is to use an integration test:

      test "GET /my_page redirects Google" do
        get "/my_page"
        assert_redirected_to "https://google.com"
      end
    

    You test needs to be under your test/integration directory or the equivalent directory where the integration tests should go.

提交回复
热议问题