Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Ruby断言和禁用的输入_Ruby On Rails_Cucumber_Testunit_Webrat - Fatal编程技术网

Ruby on rails Ruby断言和禁用的输入

Ruby on rails Ruby断言和禁用的输入,ruby-on-rails,cucumber,testunit,webrat,Ruby On Rails,Cucumber,Testunit,Webrat,有人知道如何断言复选框或输入被禁用吗?我找不到任何东西表明这是受支持的 我正在用webrat和test/unit编写cucumber测试 我希望有一个步骤能够断言_禁用:某些_复选框| |断言_禁用:某些_输入 或者我可以通过某种方式检查复选框的属性 Then /^the "([^\"]*)" field should be disabled$/ do |label| field_labeled(label).should be_disabled end 应该为你做这件事。你可以试一试:

有人知道如何断言复选框或输入被禁用吗?我找不到任何东西表明这是受支持的 我正在用webrat和test/unit编写cucumber测试

我希望有一个步骤能够断言_禁用:某些_复选框| |断言_禁用:某些_输入

或者我可以通过某种方式检查复选框的属性

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

我得到了Pete的工作答案,但不得不用id切换到field_

field_with_id(label).should be_disabled

这可能对Webrat和测试/单元没有帮助,但对于使用水豚的人,您可以使用

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

我猜没人读到我在使用测试/单元