0

我有一个位置资源并通过以下方式访问:

http://localhost:3000/locations/37/edit

在我的规范中,我有:

it "should allows us to edit" do
  @u=User.find_by_email('jon@domain.com')
  session[:user_id]=@u.id    
  get edit_location_path, {:id => '37'}

但得到以下错误:

Failures:

  1) LocationsController should allows us to edit
     Failure/Error: get edit_location_path, :id => '37'
     ActionController::RoutingError:
       No route matches {:action=>"edit", :controller=>"locations"}
     # ./spec/controllers/locations_controller_spec.rb:12:in `block (2 levels) in <top (required)>'

我将如何指定此资源的链接?

谢谢

4

2 回答 2

2

假设它是描述 的控制器规范LocationsController,您可以使用get :edit, :id => 37.

于 2012-08-28T03:41:23.770 回答
1

就做get edit_location_path(37)??

于 2012-08-28T04:50:42.407 回答