Ruby on rails “如何指向用户更新路线”;放置用户“U路径”;黄瓜上(Rails/Cumber/rspec)

Ruby on rails “如何指向用户更新路线”;放置用户“U路径”;黄瓜上(Rails/Cumber/rspec),ruby-on-rails,ruby-on-rails-3,rspec,cucumber,Ruby On Rails,Ruby On Rails 3,Rspec,Cucumber,我想用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 关于cucumber,

我想用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
关于cucumber,我创建了一个场景,但我的问题是,当我试图告诉他执行更新操作时,它不理解,如下所示:

When /^I submit to the update action$/ do
put user_path   
end
我也尝试过放置用户路径(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的特性不起作用:我应该怎么做?我应该如何在cucumber上写下这句话?

我们的路线可能会包含这样的行:

PATCH/PUT   /user/:id   update  update a specific user
并且没有指定要更新的对象的id

When /^I submit to the update action$/ do
  put user_path(user)
end
请参阅中的更多详细信息