holy crap fixed that comment dispatch bug
This commit is contained in:
parent
ed1dc584d1
commit
8f05b638b3
3 changed files with 17 additions and 8 deletions
|
|
@ -26,10 +26,9 @@ class Postzord::Dispatch
|
||||||
user_ids = [*local_people].map{|x| x.owner_id }
|
user_ids = [*local_people].map{|x| x.owner_id }
|
||||||
local_users = User.where(:id => user_ids)
|
local_users = User.where(:id => user_ids)
|
||||||
self.socket_and_notify_users(local_users)
|
self.socket_and_notify_users(local_users)
|
||||||
else
|
|
||||||
self.deliver_to_local(local_people)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
self.deliver_to_local(local_people)
|
||||||
self.deliver_to_remote(remote_people)
|
self.deliver_to_remote(remote_people)
|
||||||
end
|
end
|
||||||
self.deliver_to_services(opts[:url])
|
self.deliver_to_services(opts[:url])
|
||||||
|
|
|
||||||
|
|
@ -215,15 +215,25 @@ describe 'a user receives a post' do
|
||||||
xml = @post.to_diaspora_xml
|
xml = @post.to_diaspora_xml
|
||||||
|
|
||||||
receive_with_zord(@user2, @user1.person, xml)
|
receive_with_zord(@user2, @user1.person, xml)
|
||||||
|
receive_with_zord(@user3, @user1.person, xml)
|
||||||
|
|
||||||
@comment = @user2.comment('tada',:on => @post)
|
|
||||||
@xml = @comment.to_diaspora_xml
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not raise a `Mysql2::Error: Duplicate entry...` exception on save' do
|
it 'does not raise a `Mysql2::Error: Duplicate entry...` exception on save' do
|
||||||
#lambda {
|
@comment = @user2.comment('tada',:on => @post)
|
||||||
|
@xml = @comment.to_diaspora_xml
|
||||||
|
|
||||||
|
lambda {
|
||||||
receive_with_zord(@user1, @user2.person, @xml)
|
receive_with_zord(@user1, @user2.person, @xml)
|
||||||
#}.should_not raise_exception
|
}.should_not raise_exception
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should dispatch to the remote user' do
|
||||||
|
pending
|
||||||
|
Postzord::Receiver.should_receive(:new).exactly(3).times
|
||||||
|
|
||||||
|
@comment = @user2.comment('tada',:on => @post)
|
||||||
|
@user2.dispatch_comment(@comment)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -85,9 +85,9 @@ describe Postzord::Dispatch do
|
||||||
@mailman.post
|
@mailman.post
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not call deliver_to_local' do
|
it 'calls deliver_to_local' do
|
||||||
@mailman.stub!(:socket_and_notify_users)
|
@mailman.stub!(:socket_and_notify_users)
|
||||||
@mailman.should_not_receive(:deliver_to_local)
|
@mailman.should_receive(:deliver_to_local)
|
||||||
@mailman.post
|
@mailman.post
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue