Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authordanielgrippi <daniel@joindiaspora.com>2011-04-05 06:22:19 +0400
committerdanielgrippi <daniel@joindiaspora.com>2011-04-05 06:22:19 +0400
commitcbdbe1b29ba411c0e3d0bc504a67cf669539bb79 (patch)
treea2e6b175b9ca6e1246b1b9daf72b748b431d0ade /spec/lib
parent590e1fd93fba6939daa8d3fdb3a267639adf6fb2 (diff)
follow wip. 2 failures.
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/postzord/dispatch_spec.rb158
1 files changed, 79 insertions, 79 deletions
diff --git a/spec/lib/postzord/dispatch_spec.rb b/spec/lib/postzord/dispatch_spec.rb
index 345396c28..d1e4fae54 100644
--- a/spec/lib/postzord/dispatch_spec.rb
+++ b/spec/lib/postzord/dispatch_spec.rb
@@ -71,99 +71,52 @@ describe Postzord::Dispatch do
@zord.should_receive(:deliver_to_remote).with(@remote_people)
@zord.post
end
+ end
+
+ context "comments" do
+ before do
+ @local_luke, @local_leia, @remote_raphael = set_up_friends
+ end
- context "comments" do
+ context "local luke's post is commented on by" do
before do
- @local_luke, @local_leia, @remote_raphael = set_up_friends
+ @post = @local_luke.post(:status_message, :text => "hello", :to => @local_luke.aspects.first)
end
-
- context "local luke's post is commented on by" do
+ context "local leia" do
before do
- @post = @local_luke.post(:status_message, :text => "hello", :to => @local_luke.aspects.first)
- end
- context "local leia" do
- before do
- @comment = @local_leia.build_comment "yo", :on => @post
- @comment.save
- end
- context "local leia's mailman" do
- before do
- @mailman = Postzord::Dispatch.new(@local_leia, @comment)
- end
- it 'calls deliver_to_local with local_luke' do
- @mailman.should_receive(:deliver_to_local).with([@local_luke.person])
- @mailman.post
- end
- it 'calls deliver_to_remote with nobody' do
- @mailman.should_receive(:deliver_to_remote).with([])
- @mailman.post
- end
- it 'does not call socket_to_users' do
- @mailman.should_not_receive(:socket_to_users)
- @mailman.post
- end
- it 'does not call notify_users' do
- @mailman.should_not_receive(:notify_users)
- @mailman.post
- end
- end
- context "local luke's mailman" do
- before do
- @mailman = Postzord::Dispatch.new(@local_luke, @comment)
- end
- it 'does not call deliver_to_local' do
- @mailman.should_not_receive(:deliver_to_local)
- @mailman.post
- end
- it 'calls deliver_to_remote with remote raphael' do
- @mailman.should_receive(:deliver_to_remote).with([@remote_raphael])
- @mailman.post
- end
- it 'calls socket_to_users' do
- @mailman.should_receive(:socket_to_users).with([@local_leia, @local_luke])
- @mailman.post
- end
- it 'calls notify_users' do
- @mailman.should_receive(:notify_users).with([@local_leia])
- @mailman.post
- end
- end
-
+ @comment = @local_leia.build_comment "yo", :on => @post
+ @comment.save
end
- context "remote raphael" do
+ context "local leia's mailman" do
before do
- @comment = Factory.build(:comment, :author => @remote_raphael, :post => @post)
- @comment.save
- @mailman = Postzord::Dispatch.new(@local_luke, @comment)
+ @mailman = Postzord::Dispatch.new(@local_leia, @comment)
end
- it 'does not call deliver_to_local' do
- @mailman.should_not_receive(:deliver_to_local)
+ it 'calls deliver_to_local with local_luke' do
+ @mailman.should_receive(:deliver_to_local).with([@local_luke.person])
@mailman.post
end
- it 'calls deliver_to_remote with remote_raphael' do
- @mailman.should_receive(:deliver_to_remote).with([@remote_raphael])
+ it 'calls deliver_to_remote with nobody' do
+ @mailman.should_receive(:deliver_to_remote).with([])
@mailman.post
end
- it 'calls socket_to_users' do
- @mailman.should_receive(:socket_to_users).with([@local_leia])
+ it 'does not call socket_to_users' do
+ @mailman.should_not_receive(:socket_to_users)
@mailman.post
end
- it 'calls notify_users' do
- @mailman.should_receive(:notify_users).with([@local_leia])
+ it 'does not call notify_users' do
+ @mailman.should_not_receive(:notify_users)
@mailman.post
end
end
- context "local luke" do
+ context "local luke's mailman" do
before do
- @comment = @local_luke.build_comment "yo", :on => @post
- @comment.save
@mailman = Postzord::Dispatch.new(@local_luke, @comment)
end
it 'does not call deliver_to_local' do
@mailman.should_not_receive(:deliver_to_local)
@mailman.post
end
- it 'calls deliver_to_remote with remote_raphael' do
+ it 'calls deliver_to_remote with remote raphael' do
@mailman.should_receive(:deliver_to_remote).with([@remote_raphael])
@mailman.post
end
@@ -176,31 +129,78 @@ describe Postzord::Dispatch do
@mailman.post
end
end
+
end
- context "remote raphael's post is commented on by local luke" do
+ context "remote raphael" do
before do
- @post = Factory(:status_message, :author => @remote_raphael)
- @comment = @local_luke.build_comment "yo", :on => @post
+ @comment = Factory.build(:comment, :author => @remote_raphael, :post => @post)
@comment.save
@mailman = Postzord::Dispatch.new(@local_luke, @comment)
end
+ it 'does not call deliver_to_local' do
+ @mailman.should_not_receive(:deliver_to_local)
+ @mailman.post
+ end
it 'calls deliver_to_remote with remote_raphael' do
@mailman.should_receive(:deliver_to_remote).with([@remote_raphael])
@mailman.post
end
- it 'calls deliver_to_local with nobody' do
- @mailman.should_receive(:deliver_to_local).with([])
+ it 'calls socket_to_users' do
+ @mailman.should_receive(:socket_to_users).with([@local_leia])
+ @mailman.post
+ end
+ it 'calls notify_users' do
+ @mailman.should_receive(:notify_users).with([@local_leia])
+ @mailman.post
+ end
+ end
+ context "local luke" do
+ before do
+ @comment = @local_luke.build_comment "yo", :on => @post
+ @comment.save
+ @mailman = Postzord::Dispatch.new(@local_luke, @comment)
+ end
+ it 'does not call deliver_to_local' do
+ @mailman.should_not_receive(:deliver_to_local)
+ @mailman.post
+ end
+ it 'calls deliver_to_remote with remote_raphael' do
+ @mailman.should_receive(:deliver_to_remote).with([@remote_raphael])
@mailman.post
end
- it 'does not call socket_to_users' do
- @mailman.should_not_receive(:socket_to_users)
+ it 'calls socket_to_users' do
+ @mailman.should_receive(:socket_to_users).with([@local_leia, @local_luke])
@mailman.post
end
- it 'does not call notify_users' do
- @mailman.should_not_receive(:notify_users)
+ it 'calls notify_users' do
+ @mailman.should_receive(:notify_users).with([@local_leia])
@mailman.post
end
+ end
+ end
+ context "remote raphael's post is commented on by local luke" do
+ before do
+ @post = Factory(:status_message, :author => @remote_raphael)
+ @comment = @local_luke.build_comment "yo", :on => @post
+ @comment.save
+ @mailman = Postzord::Dispatch.new(@local_luke, @comment)
+ end
+ it 'calls deliver_to_remote with remote_raphael' do
+ @mailman.should_receive(:deliver_to_remote).with([@remote_raphael])
+ @mailman.post
+ end
+ it 'calls deliver_to_local with nobody' do
+ @mailman.should_receive(:deliver_to_local).with([])
+ @mailman.post
+ end
+ it 'does not call socket_to_users' do
+ @mailman.should_not_receive(:socket_to_users)
+ @mailman.post
+ end
+ it 'does not call notify_users' do
+ @mailman.should_not_receive(:notify_users)
+ @mailman.post
end
end
end