From 11758beaf325c8c0989ddd518a2237e51fa737a1 Mon Sep 17 00:00:00 2001 From: Raphael Date: Wed, 11 Aug 2010 14:26:39 -0700 Subject: [PATCH] RS, DG; Removed from xml --- lib/diaspora/parser.rb | 2 +- lib/diaspora/webhooks.rb | 2 -- spec/lib/diaspora_parser_spec.rb | 26 +++----------------------- spec/lib/web_hooks_spec.rb | 4 ---- 4 files changed, 4 insertions(+), 30 deletions(-) diff --git a/lib/diaspora/parser.rb b/lib/diaspora/parser.rb index b670c637a..5783e3e5d 100644 --- a/lib/diaspora/parser.rb +++ b/lib/diaspora/parser.rb @@ -8,7 +8,7 @@ module Diaspora def parse_body_contents_from_xml(xml) doc = Nokogiri::XML(xml) { |cfg| cfg.noblanks } - doc.xpath("/XML/posts/post") + doc.xpath("/XML/post") end def parse_owner_id_from_xml(doc) diff --git a/lib/diaspora/webhooks.rb b/lib/diaspora/webhooks.rb index 1249cc5bf..dba3968e2 100644 --- a/lib/diaspora/webhooks.rb +++ b/lib/diaspora/webhooks.rb @@ -36,9 +36,7 @@ module Diaspora def to_diaspora_xml xml = "" - xml += "" xml += "#{self.to_xml.to_s}" - xml += "" xml += "" end diff --git a/spec/lib/diaspora_parser_spec.rb b/spec/lib/diaspora_parser_spec.rb index 8f90c9cbf..6bbf68b5f 100644 --- a/spec/lib/diaspora_parser_spec.rb +++ b/spec/lib/diaspora_parser_spec.rb @@ -23,31 +23,16 @@ describe Diaspora::Parser do it "should reject xml with no sender" do xml = " - + \n Here is another message\n a@a.com\n a@a.com\n a@a.com\n \n HEY DUDE\n a@a.com\n a@a.com\n a@a.com\n - " + " store_objects_from_xml(xml, @user) Post.count.should == 0 end - it "should reject xml with a sender not in the database" do - xml = " - - - foo@example.com - - - \n Here is another message\n a@a.com\n a@a.com\n a@a.com\n - - \n HEY DUDE\n a@a.com\n a@a.com\n a@a.com\n - " - store_objects_from_xml(xml, @user) - Post.count.should == 0 - end - it 'should discard types which are not of type post' do xml = " @@ -71,8 +56,6 @@ describe Diaspora::Parser do it 'should be able to parse the body\'s contents' do body = parse_body_contents_from_xml(@xml).to_s - body.should_not include "" - body.should_not include "" body.should include "" body.should include "" end @@ -87,10 +70,7 @@ describe Diaspora::Parser do person = Factory.create(:person, :email => "test@testing.com") post = Factory.create(:status_message, :person => @user.person) comment = Factory.build(:comment, :post => post, :person => person, :text => "Freedom!") - xml = " - - #{comment.to_xml} - " + xml = comment.to_diaspora_xml objects = parse_objects_from_xml(xml) comment = objects.first diff --git a/spec/lib/web_hooks_spec.rb b/spec/lib/web_hooks_spec.rb index 150bacef8..63739f636 100644 --- a/spec/lib/web_hooks_spec.rb +++ b/spec/lib/web_hooks_spec.rb @@ -22,10 +22,6 @@ describe Diaspora do @post.respond_to?(:people_with_permissions).should be true end - it "should convert an object to a proper diaspora entry" do - @post.to_diaspora_xml.should == "#{@post.to_xml.to_s}" - end - it "should retrieve all valid person endpoints" do @user.friends << Factory.create(:person, :url => "http://www.bob.com/") @user.friends << Factory.create(:person, :url => "http://www.alice.com/")