Ruby on rails 我的黄瓜考试不及格,没填表格
我对rails非常陌生,甚至比BDD还新。我试图坚持干巴巴的方法论,但有些东西不在这里 特征 步骤定义 测试结果Ruby on rails 我的黄瓜考试不及格,没填表格,ruby-on-rails,cucumber,factory-bot,Ruby On Rails,Cucumber,Factory Bot,我对rails非常陌生,甚至比BDD还新。我试图坚持干巴巴的方法论,但有些东西不在这里 特征 步骤定义 测试结果 据我所知,步骤定义并没有填写表单,但根据结果中的这一行,表单值确实正确存在{“车辆制造商”=>“道奇”、“车辆型号”=>“RAM 1500”、“车辆年份”=>“2005”、“车辆发动机”=>“5.7L”、“车辆颜色”=>“黑色”}问题在于以下几行: fill_in field.to_sym, :with => value 具体来说,.to_sym导致它无法将正确的值传递到表单
据我所知,步骤定义并没有填写表单,但根据结果中的这一行,表单值确实正确存在<代码>{“车辆制造商”=>“道奇”、“车辆型号”=>“RAM 1500”、“车辆年份”=>“2005”、“车辆发动机”=>“5.7L”、“车辆颜色”=>“黑色”}问题在于以下几行:
fill_in field.to_sym, :with => value
具体来说,.to_sym
导致它无法将正确的值传递到表单字段中。卸下.to_sym
并使其:
fill_in field, :with => value
修正了这个问题,我的测试现在通过了,同时坚持干方法
Scenario: Add a new vehicle with valid data
Given I exist as a user
And I am logged in
And I am on the Create New Vehicle page
When I fill out the form with the following attributes:
| attribute_name | attribute_name | // write attribute name here
| vehicle_make | DODGE |
| vehicle_model | RAM 1500 |
| vehicle_year | 2005 |
| vehicle_engine | 5.7L |
| vehicle_color | Black |
And I click the Create Vehicle button
Then I should see Vehicle was successfully created.
比如说
| name | display_name | // name and display_name it's a attribute name
| Ollie | ollie |
| David | player |
| Victoria | Victoria |
我的猜测是验证错误或其他原因阻止了这项工作。单击按钮后尝试“并向我显示页面”。
fill_in field, :with => value
Scenario: Add a new vehicle with valid data
Given I exist as a user
And I am logged in
And I am on the Create New Vehicle page
When I fill out the form with the following attributes:
| attribute_name | attribute_name | // write attribute name here
| vehicle_make | DODGE |
| vehicle_model | RAM 1500 |
| vehicle_year | 2005 |
| vehicle_engine | 5.7L |
| vehicle_color | Black |
And I click the Create Vehicle button
Then I should see Vehicle was successfully created.
| name | display_name | // name and display_name it's a attribute name
| Ollie | ollie |
| David | player |
| Victoria | Victoria |