0
,我已經得到了情景下面的代碼,其中用戶嘗試不用密碼註冊:黃瓜測試,以確保一個錯誤消息附加到一個特定形式的字段使用設計和黃瓜
Then /^I should see a missing password message$/ do
page.should have_content "Password can't be blank"
end
在窗體頂部顯示錯誤時沒問題,但現在我已切換到內嵌消息,這意味着該屬性名稱不再在其相關的錯誤消息中引用,所以我需要將我的代碼更改爲:
Then /^I should see a missing password message$/ do
page.should have_content "can't be blank"
end
現在我的特徵通過了,但我不是100%hap py這個解決方案。如果我還可以測試這條消息是否附加到空的password_field,而不是僅僅定位在頁面上某處,我會感覺更好。我想知道是否有這樣的說法:
Then /^I should see a missing password message$/ do
password_field.should have_content "can't be blank"
end
我對黃瓜很新鮮。
感謝@cheeseweasel,是有很大幫助。 – stephenmurdoch 2012-08-09 08:48:36
完全沒問題:) – 2012-08-09 08:53:06