【发布时间】:2013-07-04 16:33:24
【问题描述】:
我想用 cucumber 做相当于我在 rspec 上的测试。
在 rspec 上,我写道:
describe "submitting to the update action" do
before { put user_path(user) }
specify { response.should redirect_to(new_user_session_path)}
end
在黄瓜上我创建了一个场景,但我的问题是当我尝试告诉他执行 更新操作时它不理解如下:
When /^I submit to the update action$/ do
put user_path
end
我也试过 put user_path(user) 但它不起作用并给我错误:
When I submit to the update action # features/step_definitions/user_steps.rb:148
No route matches {:action=>"show", :controller=>"users"} (ActionController::RoutingError)
我觉得将 user_path 放在 rspec 上的正确语法不适用于 cucumber 的功能:我该怎么办?这个在黄瓜上怎么写?
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-3 rspec cucumber