Fix 500 in publicsController

This commit is contained in:
Raphael Sofaer 2011-03-14 16:48:07 -07:00
parent ae22dcc274
commit 1666843aa9
2 changed files with 5 additions and 1 deletions

View file

@ -49,7 +49,7 @@ class PublicsController < ApplicationController
person = Person.where(:guid => params[:guid]).first
if person.owner_id.nil?
if person.nil? || person.owner_id.nil?
Rails.logger.error("Received post for nonexistent person #{params[:guid]}")
render :nothing => true, :status => 404
return

View file

@ -55,6 +55,10 @@ describe PublicsController do
post :receive, "guid" => @person.guid.to_s, "xml" => xml
response.should be_not_found
end
it 'returns a 404 if no person is found' do
post :receive, :guid => '2398rq3948yftn', :xml => xml
response.should be_not_found
end
end
describe '#hcard' do