diff --git a/app/views/people/show.html.haml b/app/views/people/show.html.haml
index d24015121..dc2c8330f 100644
--- a/app/views/people/show.html.haml
+++ b/app/views/people/show.html.haml
@@ -51,9 +51,9 @@
= t('.recent_posts')
- else
= t('.recent_public_posts')
-
- %ul{:class => 'stream', :id => 'main_stream'}
- = render 'shared/stream', :posts => @post_hashes
+
+ %ul{:class => 'stream', :id => 'main_stream'}
+ = render 'shared/stream', :posts => @post_hashes
= will_paginate @posts
- else
diff --git a/spec/controllers/photos_controller_spec.rb b/spec/controllers/photos_controller_spec.rb
index 65810347e..bc118984b 100644
--- a/spec/controllers/photos_controller_spec.rb
+++ b/spec/controllers/photos_controller_spec.rb
@@ -7,21 +7,21 @@ require 'spec_helper'
describe PhotosController do
render_views
- let(:user) {make_user}
+ let(:user1) {make_user}
let(:user2) {make_user}
- let!(:aspect) { user.aspects.create(:name => 'winners') }
+ let(:aspect1) { user1.aspects.create(:name => 'winners') }
let(:aspect2) { user2.aspects.create(:name => 'winners') }
let(:filename) { 'button.png' }
let(:fixture_name) { File.join(File.dirname(__FILE__), '..', 'fixtures', filename) }
let(:image) { File.open(fixture_name) }
- let!(:photo) { user.post(:photo, :user_file => image, :to => aspect.id) }
+ let!(:photo1) { user1.post(:photo, :user_file => image, :to => aspect1.id) }
let!(:photo2) { user2.post(:photo, :user_file => image, :to => aspect2.id) }
before do
- connect_users(user, aspect, user2, aspect2)
- sign_in :user, user
+ connect_users(user1, aspect1, user2, aspect2)
+ sign_in :user, user1
end
describe '#create' do
@@ -36,18 +36,18 @@ describe PhotosController do
}.should change(Photo, :count).by(1)
end
it 'can set the photo as the profile photo' do
- old_url = user.person.profile.image_url
+ old_url = user1.person.profile.image_url
@params[:photo][:set_profile_photo] = true
post :create, @params
- user.reload.person.profile.image_url.should_not == old_url
+ user1.reload.person.profile.image_url.should_not == old_url
end
end
describe '#index' do
- it 'defaults to returning all of users pictures' do
- get :index, :person_id => user.person.id.to_s
- assigns[:person].should == user.person
- assigns[:posts].should == [photo]
+ it "displays the logged in user's pictures" do
+ get :index, :person_id => user1.person.id.to_s
+ assigns[:person].should == user1.person
+ assigns[:posts].should == [photo1]
end
it 'sets the person to a contact if person_id is set' do
@@ -60,10 +60,10 @@ describe PhotosController do
describe '#show' do
it 'assigns the photo based on the photo id' do
- get :show, :id => photo.id
+ get :show, :id => photo1.id
response.status.should == 200
- assigns[:photo].should == photo
+ assigns[:photo].should == photo1
assigns[:ownership].should be_true
end
@@ -71,21 +71,21 @@ describe PhotosController do
describe '#edit' do
it 'lets the user edit a photo' do
- get :edit, :id => photo.id
+ get :edit, :id => photo1.id
response.status.should == 200
end
it 'does not let the user edit a photo that is not his' do
get :edit, :id => photo2.id
- response.should redirect_to(:action => :index, :person_id => user.person.id.to_s)
+ response.should redirect_to(:action => :index, :person_id => user1.person.id.to_s)
end
end
describe '#destroy' do
it 'allows the user to delete his photos' do
- delete :destroy, :id => photo.id
- Photo.find_by_id(photo.id).should be_nil
+ delete :destroy, :id => photo1.id
+ Photo.find_by_id(photo1.id).should be_nil
end
it 'will not let you destory posts you do not own' do
@@ -96,28 +96,28 @@ describe PhotosController do
describe "#update" do
it "updates the caption of a photo" do
- put :update, :id => photo.id, :photo => { :caption => "now with lasers!" }
- photo.reload.caption.should == "now with lasers!"
+ put :update, :id => photo1.id, :photo => { :caption => "now with lasers!" }
+ photo1.reload.caption.should == "now with lasers!"
end
it "doesn't overwrite random attributes" do
- new_user = Factory.create :user
+ new_user = make_user
params = { :caption => "now with lasers!", :person_id => new_user.id }
- put :update, :id => photo.id, :photo => params
- photo.reload.person_id.should == user.person.id
+ put :update, :id => photo1.id, :photo => params
+ photo1.reload.person_id.should == user1.person.id
end
it 'redirects if you do not have access to the post' do
params = { :caption => "now with lasers!" }
put :update, :id => photo2.id, :photo => params
- response.should redirect_to(:action => :index, :person_id => user.person.id.to_s)
+ response.should redirect_to(:action => :index, :person_id => user1.person.id.to_s)
end
end
describe "#make_profile_photo" do
it 'should return a 201 on a js success' do
- get :make_profile_photo, :photo_id => photo.id, :format => 'js'
+ get :make_profile_photo, :photo_id => photo1.id, :format => 'js'
response.code.should == "201"
end