Trying to get photos working again

This commit is contained in:
Raphael 2010-07-22 10:12:25 -07:00
parent 14533f6534
commit b6ab4db7cc
2 changed files with 4 additions and 4 deletions

View file

@ -21,7 +21,7 @@ module Diaspora
object.person = parse_owner_from_xml post.to_s if object.respond_to? :person object.person = parse_owner_from_xml post.to_s if object.respond_to? :person
objects << object objects << object
rescue rescue
puts "Not a real type: #{object.to_s}" Rails.logger.info "Not a real type: #{object.to_s}"
end end
end end
objects objects

View file

@ -5,7 +5,7 @@ describe Photo do
@user = Factory.create(:user) @user = Factory.create(:user)
@fixture_name = File.dirname(__FILE__) + '/../fixtures/bp.jpeg' @fixture_name = File.dirname(__FILE__) + '/../fixtures/bp.jpeg'
@fail_fixture_name = File.dirname(__FILE__) + '/../fixtures/msg.xml' @fail_fixture_name = File.dirname(__FILE__) + '/../fixtures/msg.xml'
@photo = Photo.new(:person => @user, :album => Album.create(:name => "foo")) @photo = Photo.new(:person => @user, :album => Album.create(:name => "foo", :person => @user))
end end
it 'should save a @photo to GridFS' do it 'should save a @photo to GridFS' do
file = File.open(@fixture_name) file = File.open(@fixture_name)
@ -36,7 +36,7 @@ describe Photo do
it 'must have an album' do it 'must have an album' do
photo = Photo.new(:person => @user) photo = Photo.new(:person => @user)
photo.valid?.should be false photo.valid?.should be false
photo.album = Album.new(:name => "foo") photo.album = Album.new(:name => "foo", :person => @user)
photo.save photo.save
Photo.first.album.name.should == 'foo' Photo.first.album.name.should == 'foo'
end end
@ -64,7 +64,7 @@ describe Photo do
it 'should write the url on serialization' do it 'should write the url on serialization' do
@photo.image = File.open(@fixture_name) @photo.image = File.open(@fixture_name)
xml = @photo.to_xml.to_s xml = @photo.to_xml.to_s
xml.include?(@photo.image.path).should be true xml.include?(@photo.image.url).should be true
remote_photo = Photo.from_xml xml remote_photo = Photo.from_xml xml
@photo.destroy @photo.destroy
remote_photo.image.read.nil?.should be false remote_photo.image.read.nil?.should be false