我正在用rspec在我的rails 3.2應用程序中測試視圖。Rspec視圖測試不會呈現變化
我已經爲我的視圖編寫了測試,以包含一些額外的輸入字段,並且他們正確地失敗了。但是,添加所需的輸入字段後,測試仍會以相同的方式失敗。他們在終端輸出表格,就好像我沒有改變視圖中的任何內容。
當在瀏覽器中檢查視圖時,這些字段實際上存在,所以測試應該通過。
有rspec沒有加載最新的意見?
下面是一些代碼(我把它減少到兩個字段):
it "renders the form to sign up" do
rendered.should have_selector("form", action: "/users", method: "post") do |form|
form.should have_selector("input#user_email", name: "user[email]", type: "email")
form.should have_selector("input#user_city", name: "user[city]", type: "text")
end
end
電子郵件輸入是一個古老的輸入,我收到了,它也承認它。城市輸入是新的,它甚至不出現在終端的視圖輸出中。
我在做什麼錯?