From be5453f0b4d29641a9812c240582cd2281390b59 Mon Sep 17 00:00:00 2001 From: Raphael Sofaer Date: Tue, 2 Aug 2011 10:16:11 -0700 Subject: [PATCH] Fix photo show pages with likes --- app/views/photos/show.html.haml | 2 +- spec/controllers/photos_controller_spec.rb | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/views/photos/show.html.haml b/app/views/photos/show.html.haml index 296f6fbb5..2f2122e25 100644 --- a/app/views/photos/show.html.haml +++ b/app/views/photos/show.html.haml @@ -66,5 +66,5 @@ #photo_stream.stream.show %div{:data=>{:guid=>parent.id}} .likes_container - = render "likes/likes_container", :post_id => parent.id, :likes_count => parent.likes_count + = render "likes/likes_container", :post_id => parent.id, :target_type => 'Post', :likes_count => parent.likes_count = render "comments/comments", :post => parent, :comments => parent.comments, :always_expanded => true diff --git a/spec/controllers/photos_controller_spec.rb b/spec/controllers/photos_controller_spec.rb index 483389931..b5b49a3f0 100644 --- a/spec/controllers/photos_controller_spec.rb +++ b/spec/controllers/photos_controller_spec.rb @@ -65,18 +65,25 @@ describe PhotosController do end context "private photo user can see" do - before do - get :show, :id => @bobs_photo.id - end - it "succeeds" do + get :show, :id => @bobs_photo.id response.should be_success end it "assigns the photo" do + get :show, :id => @bobs_photo.id assigns[:photo].should == @bobs_photo @controller.ownership.should be_false end + + it 'succeeds with a like present' do + sm = bob.post(:status_message, :text => 'parent post', :to => 'all') + @bobs_photo.status_message_guid = sm.guid + @bobs_photo.save! + alice.like(1, :target => @bobs_photo.status_message) + get :show, :id => @bobs_photo.id + response.should be_success + end end context "private photo user cannot see" do