Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/activity_streams/photo.rb1
-rw-r--r--spec/factories.rb9
-rw-r--r--spec/models/activity_streams/photo_spec.rb8
3 files changed, 18 insertions, 0 deletions
diff --git a/app/models/activity_streams/photo.rb b/app/models/activity_streams/photo.rb
index 4932fff89..44ada54b2 100644
--- a/app/models/activity_streams/photo.rb
+++ b/app/models/activity_streams/photo.rb
@@ -5,6 +5,7 @@
class ActivityStreams::Photo < Post
include Diaspora::Socketable
+ xml_name "activity_streams::_photo"
xml_attr :image_url
xml_attr :image_height
xml_attr :image_width
diff --git a/spec/factories.rb b/spec/factories.rb
index 7b6173d09..b7f7aac31 100644
--- a/spec/factories.rb
+++ b/spec/factories.rb
@@ -104,3 +104,12 @@ Factory.define(:notification) do |n|
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
diff --git a/spec/models/activity_streams/photo_spec.rb b/spec/models/activity_streams/photo_spec.rb
index 4081676ec..f334bc2e5 100644
--- a/spec/models/activity_streams/photo_spec.rb
+++ b/spec/models/activity_streams/photo_spec.rb
@@ -25,4 +25,12 @@ JSON
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