MS IZ setting the diaspora handle in photo instantiate
This commit is contained in:
parent
ab4e3a9f7f
commit
4de89df4dc
2 changed files with 9 additions and 0 deletions
|
|
@ -38,6 +38,7 @@ class Photo < Post
|
||||||
person = params.delete(:person)
|
person = params.delete(:person)
|
||||||
|
|
||||||
photo = Photo.new(params)
|
photo = Photo.new(params)
|
||||||
|
photo.diaspora_handle = params[:diaspora_handle]
|
||||||
|
|
||||||
photo.image.store! image_file
|
photo.image.store! image_file
|
||||||
photo.person = person
|
photo.person = person
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@ describe Photo do
|
||||||
@photo = Photo.new(:album => @album)
|
@photo = Photo.new(:album => @album)
|
||||||
@photo.person = @user.person
|
@photo.person = @user.person
|
||||||
@photo.diaspora_handle = @user.person.diaspora_handle
|
@photo.diaspora_handle = @user.person.diaspora_handle
|
||||||
|
|
||||||
|
@photo2 = @user.post(:photo, :user_file=> File.open(@fixture_name), :to => @aspect.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "protected attributes" do
|
describe "protected attributes" do
|
||||||
|
|
@ -36,6 +38,12 @@ describe Photo do
|
||||||
@photo.mutable?.should == true
|
@photo.mutable?.should == true
|
||||||
end
|
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
|
it 'has a constructor' do
|
||||||
image = File.open(@fixture_name)
|
image = File.open(@fixture_name)
|
||||||
photo = Photo.instantiate(
|
photo = Photo.instantiate(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue