我正在使用 Rails 3 和 Cucumber,除了这个小问题之外一切都很顺利
Given I am on the "edit automobile" page
No route matches {:controller=>"automobiles", :action=>"edit"} (ActionController::RoutingError)
现在路径在 paths.rb 中设置为 edit_automobile_path
在routes.rb中我有汽车作为资源,我用脚手架搭建了它
所以请告诉我我错过了什么,清楚地定义了路线并匹配,因为我运行了 rake 路线并看到了路线。
请给我指出正确的方向
In your features/support/paths.rb
像这样的路径文件指定了您需要传递的唯一资源edit_automobile_path
an id,
在你的耙子路线中它看起来像automobiles/:id/edit
所以你需要有edit_automobile_path(:id
)
为了在黄瓜中做到这一点,假设你有类似的东西
Given I have an automobile
And I am on the 'edit automobile' page
在给定的步骤 def 声明一个变量@automobile = Automobile.create()
然后在你的 paths.rb 文件中
when /edit automobile page/
edit_automobile_path @automobile
...
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)