Ruby Claims and Disabled Inputs

Does anyone know how to claim that a checkbox or input is disabled? I cannot find anything to indicate that this is supported. I am writing cucumber tests with webrat and test / unit.

I would like to take a step capable of assert_disabled: some_checkbox || assert_disabled: some_input.

Or somehow I can check the checkbox property.

+3
source share
4 answers
Then /^the "([^\"]*)" field should be disabled$/ do |label|
  field_labeled(label).should be_disabled
end

should do it for you.

+4
source

This probably won't help you with Webrat and Test / Unit, but for people using Capybara, you can use

Then /^the "([^\"]+)" field should be disabled$/ do |field|
  find_field(field)[:disabled].should == 'disabled'
end
+3
source

:

Then /^the "([^\"]*)" field should be disabled$/ do |label|
  field_labeled(label)['disabled'].should == true
end
0

, field_with_id.

field_with_id(label).should be_disabled
0

Source: https://habr.com/ru/post/1728127/


All Articles