Skip to content
Extraits de code Groupes Projets
Valider b6ab4db7 rédigé par Raphael's avatar Raphael
Parcourir les fichiers

Trying to get photos working again

parent 14533f65
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -21,7 +21,7 @@ module Diaspora ...@@ -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
......
...@@ -5,7 +5,7 @@ describe Photo do ...@@ -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 ...@@ -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 ...@@ -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
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter