Make intended behavior on hcard action clearer, return 404 on nonexistent person
This commit is contained in:
parent
04d5271530
commit
8cf72441b4
2 changed files with 17 additions and 1 deletions
|
|
@ -12,6 +12,8 @@ class PublicsController < ApplicationController
|
|||
@person = Person.find_by_id params[:id]
|
||||
unless @person.nil? || @person.owner.nil?
|
||||
render 'hcard'
|
||||
else
|
||||
render :nothing => true, :status => 404
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -24,7 +26,7 @@ class PublicsController < ApplicationController
|
|||
unless @person.nil? || @person.owner.nil?
|
||||
render 'webfinger', :content_type => 'application/xrd+xml'
|
||||
else
|
||||
render :nothing => true
|
||||
render :nothing => true, :status => 404
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,20 @@ describe PublicsController do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#hcard' do
|
||||
it 'queries by person id' do
|
||||
post :hcard, :id => user.person.id
|
||||
assigns[:person].should == user.person
|
||||
response.code.should == '200'
|
||||
end
|
||||
|
||||
it 'does not query by user id' do
|
||||
post :hcard, :id => user.id
|
||||
assigns[:person].should be_nil
|
||||
response.code.should == '404'
|
||||
end
|
||||
end
|
||||
|
||||
describe 'webfinger' do
|
||||
it 'should not try to webfinger out on a request to webfinger' do
|
||||
Redfinger.should_not_receive :finger
|
||||
|
|
|
|||
Loading…
Reference in a new issue