在“编辑”控制器方法上,如果未找到作为参数传递的项目,我想将用户重定向到控制器索引操作,并带有 :not_found 状态代码。这是代码:
redirect_to dashboard_posts_url, :status => :not_found
问题是我无法使用 assert_redirected_to rails 断言测试此行为,因为它期望状态代码为:重定向,如源代码所示:http ://www.rubydoc.info/docs/rails/ActionDispatch /Assertions/ResponseAssertions:assert_redirected_to :(
你有什么解决方案,而不重写断言?