Fix AS::Photo federation, hopefully

This commit is contained in:
Raphael Sofaer 2011-05-23 13:54:03 -07:00
parent 6a88abb6dd
commit d22878f3f0
3 changed files with 18 additions and 0 deletions

View file

@ -5,6 +5,7 @@
class ActivityStreams::Photo < Post class ActivityStreams::Photo < Post
include Diaspora::Socketable include Diaspora::Socketable
xml_name "activity_streams::_photo"
xml_attr :image_url xml_attr :image_url
xml_attr :image_height xml_attr :image_height
xml_attr :image_width xml_attr :image_width

View file

@ -104,3 +104,12 @@ Factory.define(:notification) do |n|
end end
end end
Factory.define(:activity_streams_photo, :class => ActivityStreams::Photo) do |p|
p.association(:author, :factory => :person)
p.image_url "http://example.com/awesome.png"
p.image_height 9001
p.image_width 4
p.object_url "http://example.com/awesome_things.html"
p.actor_url "http://notcubbi.es/cubber"
p.provider_display_name "not cubbies"
end

View file

@ -25,4 +25,12 @@ JSON
end end
end end
describe 'serialization' do
it 'Diaspora::Parser should pick the right class' do
photo = Factory(:activity_streams_photo)
xml = photo.to_diaspora_xml.to_s
Diaspora::Parser.from_xml(xml).class.should == ActivityStreams::Photo
end
end
end end