diff --git a/lib/diaspora/ostatus_builder.rb b/lib/diaspora/ostatus_builder.rb index 7242fe35e..57936396f 100644 --- a/lib/diaspora/ostatus_builder.rb +++ b/lib/diaspora/ostatus_builder.rb @@ -45,16 +45,16 @@ module Diaspora http://activitystrea.ms/schema/1.0/person #{x(@user.name)} #{AppConfig[:pod_url]}people/#{@user.person.id} - #{x(@user.username)} #{x(@user.person.name)} - XML end def create_endpoints <<-XML + + XML diff --git a/spec/lib/diaspora/atom.rng b/spec/lib/diaspora/atom.rng new file mode 100644 index 000000000..c372db608 --- /dev/null +++ b/spec/lib/diaspora/atom.rng @@ -0,0 +1,598 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text + html + + + + + + + + + xhtml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + An atom:feed must have an atom:author unless all of its atom:entry children have an atom:author. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + An atom:entry must have at least one atom:link element with a rel attribute of 'alternate' or an atom:content. + + + An atom:entry must have an atom:author if its feed does not. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text + html + + + + + + + + + + + + + xhtml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + [^:]* + + + + + + .+/.+ + + + + + + [A-Za-z]{1,8}(-[A-Za-z0-9]{1,8})* + + + + + + + + + + .+@.+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + xml:base + xml:lang + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/spec/lib/diaspora/ostatus_builder_spec.rb b/spec/lib/diaspora/ostatus_builder_spec.rb index 1ed2b48ce..256cbf223 100644 --- a/spec/lib/diaspora/ostatus_builder_spec.rb +++ b/spec/lib/diaspora/ostatus_builder_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' require File.join(Rails.root, 'lib/diaspora/ostatus_builder') - +require 'nokogiri/xml' describe Diaspora::OstatusBuilder do @@ -46,5 +46,16 @@ describe Diaspora::OstatusBuilder do director.build( builder ) report_hash["Person"].should be_nil #No people should have been instantiated end + + it 'produces a valid atom feed' do + alice.person #Preload user.person + ActiveRecord::Base.reset_instance_type_count + director = Diaspora::Director.new + messages = StatusMessage.where(:author_id => alice.person.id, :public => true) + builder = Diaspora::OstatusBuilder.new(alice, messages) + feed = Nokogiri::XML(director.build( builder )) + feed_schema = Nokogiri::XML::RelaxNG(File.open(File.join(Rails.root,'spec/lib/diaspora/atom.rng'))) + feed_schema.validate(feed).should be_empty + end end