From 7a1011c46cca8fe721281802c2e4df9a0f643243 Mon Sep 17 00:00:00 2001 From: maxwell Date: Thu, 5 Aug 2010 15:41:32 -0700 Subject: [PATCH] DG MS; webhook specs fixed --- lib/diaspora/webhooks.rb | 5 ++--- spec/lib/web_hooks_spec.rb | 15 +++++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/diaspora/webhooks.rb b/lib/diaspora/webhooks.rb index d6e8513c3..d301c999b 100644 --- a/lib/diaspora/webhooks.rb +++ b/lib/diaspora/webhooks.rb @@ -18,7 +18,7 @@ module Diaspora def push_to(recipients) unless recipients.empty? - recipients.map!{|x| x = x.url + "receive/"} + recipients.map!{|x| x = x.url + "receive/"} xml = Post.build_xml_for(self) Rails.logger.info("Adding xml for #{self} to message queue to #{recipients}") @@queue.add_post_request( recipients, xml ) @@ -39,8 +39,7 @@ module Diaspora end def people_with_permissions - puts "#{self.person.owner.friends.count} foo" - self.person.owner.friends.all + self.person.owner.friends end def self.build_xml_for(posts) diff --git a/spec/lib/web_hooks_spec.rb b/spec/lib/web_hooks_spec.rb index 6a7c34179..bb1dbc32d 100644 --- a/spec/lib/web_hooks_spec.rb +++ b/spec/lib/web_hooks_spec.rb @@ -9,13 +9,11 @@ describe Diaspora do @user = Factory.create(:user, :email => "bob@aol.com") @user.person.save @person = Factory.create(:person) - @user.friends << @person - @user.save end describe "body" do before do - @post = Factory.create(:status_message, :person => @user.person) + @post = Factory.build(:status_message, :person => @user.person) end it "should add the following methods to Post on inclusion" do @@ -33,8 +31,10 @@ describe Diaspora do @user.friends << Factory.create(:person, :url => "http://www.alice.com/") @user.friends << Factory.create(:person, :url => "http://www.jane.com/") @user.save - - @post.people_with_permissions.should == @user.friends.map{|friend| friend.url + "receive/ "} + + @post.person.owner.reload + + @post.people_with_permissions.should == @user.friends end it "should send an owners post to their people" do @@ -53,7 +53,10 @@ describe Diaspora do it "should ensure one url is created for every person" do 5.times {@user.friends << Factory.create(:person)} @user.save - @post.people_with_permissions.size.should == 6 + + @post.person.owner.reload + + @post.people_with_permissions.size.should == 5 end it "should build an xml object containing multiple Post types" do