1
如何在水豚單元測試中得到詳細的錯誤信息?如何在水豚單元測試中得到詳細的錯誤信息
describe "About" do
it "should have the h1 'About Us'" do
visit '/static_pages/about'
page.should have_selector('h1',
:text => "About Us")
end
it "should have the title 'About'" do
visit '/static_pages/about'
page.should have_title("About")
end
其測試題目是 「關於」。
如何添加自定義錯誤消息,如:
Expected "About" but found "ABT". Please Rectify the mistake.
由於水豚等行爲,你可能想自定義消息是一個進程因此它的失敗之後,而不是在開始搜索之前評估。 –
優秀的建議@湯姆波爾。我用lambda更新了我的答案。 – MilesStanfield
它顯示錯誤:參數的錯誤數量(1代表0) – riddler0212