我已經通過的位置資源和訪問:RSpec的控制器規格的訪問路線
http://localhost:3000/locations/37/edit
在我的天賦,我有:
it "should allows us to edit" do
@u=User.find_by_email('[email protected]')
session[:user_id][email protected]
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)>'
我將如何指定此資源的鏈接?
THX
看起來你正在丟失路由中的id,它沒有顯示在路由錯誤中(應該有一個':id =>'37')。 –
您可能想要模擬位置模型,並將其傳遞給edit_location_path(location) – BlueFish