我最近安裝了一個名爲Gretel的插件來照顧我的麪包屑。這似乎是偉大的工作,但它似乎是打破我的一些規格與下面的錯誤:Rails 3 - 如何擺脫「test.host」?
Failure/Error: response.should redirect_to @course
Expected response to be a redirect to </courses/904> but was a redirect to
<http://test.host/courses/904>
我能做些什麼來擺脫這種錯誤的?該路徑似乎完全正確,除了那個麻煩的test.host的東西。
謝謝!作爲對其他人的一個提示,在我的測試中,我沒有明確地檢查URL。在我的控制器中,我有「redirect_to @course」,在測試中我也有「response.should redirect_to @course」。顯然這兩者之間有些不同(我還不太瞭解),我需要在測試中更明確地將測試路徑定義爲「response.should redirect_to course_path(@course)」,以使其工作。 – sapphiremirage
很酷 - 很高興知道。我想redirect_to(@course)只是默認爲完整路徑。 –