In my routes.rb I have
resources :users, :path => '', param: :name do
resources :locations
end
This gives me my URLs exactly like I want them, e.g. http://ift.tt/1Os1EFn
However, I just can't figure out, how to test them. I ran over this, but it doesn't seem to be enough.
setup do
@location = locations(:one)
@user = users(:one)
end
test "should get index" do
get :index, user_id: @user.name
assert_response :success
assert_not_nil assigns(:locations)
end
Can someone point me into the right direction? Or is there a better (and testable) way, to achieve my URL-pattern?
Aucun commentaire:
Enregistrer un commentaire