MS IZ setting the diaspora handle in photo instantiate

This commit is contained in:
maxwell 2010-11-02 18:32:02 -07:00
parent ab4e3a9f7f
commit 4de89df4dc
2 changed files with 9 additions and 0 deletions

View file

@ -38,6 +38,7 @@ class Photo < Post
person = params.delete(:person)
photo = Photo.new(params)
photo.diaspora_handle = params[:diaspora_handle]
photo.image.store! image_file
photo.person = person

View file

@ -17,6 +17,8 @@ describe Photo do
@photo = Photo.new(:album => @album)
@photo.person = @user.person
@photo.diaspora_handle = @user.person.diaspora_handle
@photo2 = @user.post(:photo, :user_file=> File.open(@fixture_name), :to => @aspect.id)
end
describe "protected attributes" do
@ -36,6 +38,12 @@ describe Photo do
@photo.mutable?.should == true
end
describe '.instantiate' do
it 'sets the persons diaspora handle' do
@photo2.diaspora_handle.should == @user.person.diaspora_handle
end
end
it 'has a constructor' do
image = File.open(@fixture_name)
photo = Photo.instantiate(