2
我正在嘗試編寫Rails路由重定向到其他站點的測試用例。如何將Rails路線重定向到其他網站?
例如:
get "foo/:id",redirect("http://othersite.com/foo/%{id}",:status => 301)
下試圖產生的錯誤:
assert_routing "foo/123","http://othersite.com/foo/123"
我正在嘗試編寫Rails路由重定向到其他站點的測試用例。如何將Rails路線重定向到其他網站?
例如:
get "foo/:id",redirect("http://othersite.com/foo/%{id}",:status => 301)
下試圖產生的錯誤:
assert_routing "foo/123","http://othersite.com/foo/123"
基於this答案,我可以建議同樣的事情。
你嘗試:
match "/blog" => redirect("http://example.com/blog"), :as => :blog
這對你的作品?