有誰知道如何斷言複選框或輸入被禁用?我找不到任何東西來表示這是支持的 我正在用webrat和測試/單元編寫黃瓜測試。Ruby斷言和禁用的輸入
我想要一個能夠assert_disabled的步驟:some_checkbox || assert_disabled:some_input。
或某種方式,我可以檢查複選框的屬性。
有誰知道如何斷言複選框或輸入被禁用?我找不到任何東西來表示這是支持的 我正在用webrat和測試/單元編寫黃瓜測試。Ruby斷言和禁用的輸入
我想要一個能夠assert_disabled的步驟:some_checkbox || assert_disabled:some_input。
或某種方式,我可以檢查複選框的屬性。
Then /^the "([^\"]*)" field should be disabled$/ do |label|
field_labeled(label).should be_disabled
end
應該爲你做。
你可以給這個一展身手:
Then /^the "([^\"]*)" field should be disabled$/ do |label|
field_labeled(label)['disabled'].should == true
end
我得到了皮特的回答工作,但不得不改用field_with_id。
field_with_id(label).should be_disabled
這可能不會幫助你Webrat和測試/股,但對於利用水豚的人,你可以使用
Then /^the "([^\"]+)" field should be disabled$/ do |field|
find_field(field)[:disabled].should == 'disabled'
end
這是唯一的解決方案,爲我工作。謝謝! – Myxtic 2013-06-03 14:58:58
我想沒有人讀,我使用的測試/單元 – brad 2010-10-21 13:56:16