Fix 500 on tag show with comments

This commit is contained in:
Raphael Sofaer 2011-03-28 10:01:03 -07:00
parent c2a4c2157d
commit a0d3921d72
2 changed files with 8 additions and 2 deletions

View file

@ -3,7 +3,7 @@
-# the COPYRIGHT file.
%li.comment.posted{:data=>{:guid => comment.id}, :class => ("hidden" if(defined? hidden))}
- if current_user.owns?(comment) || current_user.owns?(comment.post)
- if current_user && current_user.owns?(comment) || current_user.owns?(comment.post)
.right.controls
= link_to image_tag('deletelabel.png'), comment_path(comment), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :class => "delete comment_delete", :title => t('delete')
= person_image_link(comment.author)

View file

@ -41,14 +41,20 @@ describe TagsController do
before do
@post = @user.post(:status_message, :text => "#what", :public => true, :to => 'all')
@user.post(:status_message, :text => "#hello", :public => true, :to => 'all')
get :show, :name => 'what'
end
it "succeeds" do
get :show, :name => 'what'
response.should be_success
end
it "assigns the right set of posts" do
get :show, :name => 'what'
assigns[:posts].should == [@post]
end
it 'succeeds with comments' do
@user.comment('what WHAT!', :on => @post)
get :show, :name => 'what'
response.should be_success
end
end
end
end