Removed headers
This commit is contained in:
parent
76eabef2c1
commit
de0bff17dd
3 changed files with 0 additions and 48 deletions
|
|
@ -1,16 +1,5 @@
|
|||
module Diaspora
|
||||
module XMLParser
|
||||
=begin
|
||||
def parse_sender_id_from_xml(xml)
|
||||
doc = Nokogiri::XML(xml) { |cfg| cfg.noblanks }
|
||||
doc.xpath("/XML/head/sender/email").text.to_s
|
||||
end
|
||||
|
||||
def parse_sender_object_from_xml(xml)
|
||||
sender_id = parse_sender_id_from_xml(xml)
|
||||
Friend.where(:email =>sender_id ).first
|
||||
end
|
||||
=end
|
||||
|
||||
def parse_owner_from_xml(xml)
|
||||
doc = Nokogiri::XML(xml) { |cfg| cfg.noblanks }
|
||||
|
|
@ -81,21 +70,12 @@ module Diaspora
|
|||
|
||||
def self.build_xml_for(posts)
|
||||
xml = "<XML>"
|
||||
xml += Post.generate_header
|
||||
xml += "\n <posts>"
|
||||
posts.each {|x| xml << x.prep_webhook}
|
||||
xml += "</posts>"
|
||||
xml += "</XML>"
|
||||
end
|
||||
|
||||
|
||||
def self.generate_header
|
||||
"<head>
|
||||
<sender>
|
||||
<email>#{User.first.email}</email>
|
||||
</sender>
|
||||
</head>"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -11,29 +11,6 @@ describe Diaspora do
|
|||
@friend = Factory.create(:friend)
|
||||
end
|
||||
|
||||
describe "header" do
|
||||
before do
|
||||
Factory.create(:status_message)
|
||||
Factory.create(:bookmark)
|
||||
stream = Post.stream
|
||||
@xml = Post.build_xml_for(stream)
|
||||
end
|
||||
|
||||
it "should generate" do
|
||||
@xml.should include "<head>"
|
||||
@xml.should include "</head>"
|
||||
end
|
||||
|
||||
it "should provide a sender" do
|
||||
@xml.should include "<sender>"
|
||||
@xml.should include "</sender>"
|
||||
end
|
||||
|
||||
it "should provide the owner's email" do
|
||||
@xml.should include "<email>#{User.first.email}</email>"
|
||||
end
|
||||
end
|
||||
|
||||
describe "body" do
|
||||
before do
|
||||
@post = Factory.create(:status_message, :person => @user)
|
||||
|
|
|
|||
|
|
@ -67,11 +67,6 @@ describe "parser in application helper" do
|
|||
@xml = Post.build_xml_for(@status_messages)
|
||||
end
|
||||
|
||||
it 'should be able to parse the sender\'s unique id' do
|
||||
parse_sender_id_from_xml(@xml).should == @user.email
|
||||
end
|
||||
|
||||
|
||||
it 'should be able to parse the body\'s contents' do
|
||||
body = parse_body_contents_from_xml(@xml).to_s
|
||||
body.should_not include "<head>"
|
||||
|
|
|
|||
Loading…
Reference in a new issue