From 761411e153739aef3259f6f7b5b57b3f86f55598 Mon Sep 17 00:00:00 2001 From: Raphael Sofaer Date: Fri, 8 Apr 2011 10:27:52 -0700 Subject: [PATCH] Mostly fix PeopleController#show for mobile --- app/views/people/show.mobile.haml | 8 +++----- spec/controllers/people_controller_spec.rb | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/app/views/people/show.mobile.haml b/app/views/people/show.mobile.haml index 08a78a86e..7bd5d378b 100644 --- a/app/views/people/show.mobile.haml +++ b/app/views/people/show.mobile.haml @@ -33,16 +33,14 @@ = link_to t('.return_to_aspects'), aspects_manage_path = t('.to_accept_or_ignore') -- if @posts.count > 0 +- if @posts.length > 0 -if @post_type == :photos = render 'photos/index', :photos => @posts - else #main_stream.stream = render 'shared/stream', :posts => @posts - %a.paginate - = t("more") - = will_paginate @posts - + #pagination + =link_to(t('more'), person_path(@person, :page => next_page), :class => 'paginate') - else #stream %li{:style=>"text-align:center;"} diff --git a/spec/controllers/people_controller_spec.rb b/spec/controllers/people_controller_spec.rb index fb23121fc..ce849185e 100644 --- a/spec/controllers/people_controller_spec.rb +++ b/spec/controllers/people_controller_spec.rb @@ -111,6 +111,11 @@ describe PeopleController do response.should be_success end + it 'succeeds on the mobile site' do + get :show, :id => @user.person.to_param, :format => :mobile + response.should be_success + end + it "assigns the right person" do get :show, :id => @user.person.to_param assigns(:person).should == @user.person @@ -143,6 +148,12 @@ describe PeopleController do get :show, :id => @person.id response.status.should == 200 end + + it 'succeeds on the mobile site' do + get :show, :id => @person.id, :format => :mobile + response.should be_success + end + it "assigns only public posts" do public_posts = [] public_posts << bob.post(:status_message, :text => "first public ", :to => bob.aspects[0].id, :public => true) @@ -172,6 +183,11 @@ describe PeopleController do response.should be_success end + it 'succeeds on the mobile site' do + get :show, :id => @person.id, :format => :mobile + response.should be_success + end + it "assigns only the posts the current user can see" do bob.posts.should be_empty posts_user_can_see = [] @@ -196,6 +212,11 @@ describe PeopleController do response.should be_success end + it 'succeeds on the mobile site' do + get :show, :id => @person.id, :format => :mobile + response.should be_success + end + it "assigns only public posts" do eve.posts.should be_empty eve.post(:status_message, :text => "to an aspect @user is not in", :to => eve.aspects.first.id)