Skip to content
Extraits de code Groupes Projets
Valider cc1add81 rédigé par Gonzalo Rodriguez's avatar Gonzalo Rodriguez
Parcourir les fichiers

Avoid RecordNotFound exception thrown by find method when invalid person_id

parent d084c708
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -141,7 +141,7 @@ class PeopleController < ApplicationController ...@@ -141,7 +141,7 @@ class PeopleController < ApplicationController
end end
def contacts def contacts
@person = Person.find(params[:person_id]) @person = Person.find_by_id(params[:person_id])
if @person if @person
@contact = current_user.contact_for(@person) @contact = current_user.contact_for(@person)
@aspect = :profile @aspect = :profile
......
...@@ -322,6 +322,12 @@ describe PeopleController do ...@@ -322,6 +322,12 @@ describe PeopleController do
assigns(:contacts_of_contact).should == contacts assigns(:contacts_of_contact).should == contacts
response.should be_success response.should be_success
end end
it 'shows an error when invalid person id' do
get :contacts, :person_id => 'foo'
flash[:error].should be_present
response.should redirect_to people_path
end
end end
describe '#webfinger' do describe '#webfinger' do
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter