3
내가 같이 사용자 이름과 일치하는 제약 경로가 실패 서버에서 제대로 작동하더라도 "경로를 찾을 수 없으므로"실패합니다. 그래서 내가 잘못하고 무엇을하고RSpec에 테스트
resources :users do
# nested routes
end
및
xhr :post, :destroy, :id => "999999", :photo_id => "999999", :user_id => @photo_owner.id
을 : 내 경로에 user_id
를 사용하여 때
describe "for an invalid request" do
it "should render a 404 if an associated photo is not found" do
# give it a bad photo id
xhr :post, :destroy, :id => "999999", :photo_id => "999999", :username => @photo_owner.username
# not found
response.status.should == not_found
end
end
이 테스트는 이전 사용자 이름으로 전환에 잘 작동했다 변경되었습니다?
내 서버 콘솔 내가 제대로 전달 된 모든 매개 변수가 있어야 의미하는이 보여줍니다 경로 정의
Processing by TagsController#destroy as JS
Parameters: {"constrain"=>{"username"=>/^_?[a-z]_?(?:[a-z0-9]_?)*$/i}, "username"=>"rubynewb", "photo_id"=>"2004-the-title-of-the-photo-here", "id"=>"1797"}
감사합니다 !!!! 그런 단순한 실수! – ZeNewb