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
diff options
context:
space:
mode:
authordanielgrippi <danielgrippi@gmail.com>2011-07-13 06:03:35 +0400
committerRaphael Sofaer <raphael@joindiaspora.com>2011-07-22 05:22:17 +0400
commitf3a515eef165095b79de85418e33eb968e65e59a (patch)
treebb14e0a44bc7ea4bae84af1c75c615262949ee6d /spec
parentd1bbbdbc4c2c91af69fa841572d9116d93f1ff97 (diff)
DG IZ reshare retractions is WIP
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/reshares_controller_spec.rb5
-rw-r--r--spec/lib/postzord/dispatch_spec.rb18
-rw-r--r--spec/models/reshare_spec.rb16
3 files changed, 35 insertions, 4 deletions
diff --git a/spec/controllers/reshares_controller_spec.rb b/spec/controllers/reshares_controller_spec.rb
index 23508cf86..5dbaaab7a 100644
--- a/spec/controllers/reshares_controller_spec.rb
+++ b/spec/controllers/reshares_controller_spec.rb
@@ -29,6 +29,11 @@ describe ResharesController do
bob.should_receive(:add_to_streams)
post :create, :format => :js, :root_id => @post_id
end
+
+ it 'calls dispatch' do
+ bob.should_receive(:dispatch_post).with(anything, hash_including(:additional_subscribers))
+ post :create, :format => :js, :root_id => @post_id
+ end
end
end
end
diff --git a/spec/lib/postzord/dispatch_spec.rb b/spec/lib/postzord/dispatch_spec.rb
index 6991e8b93..da8181c54 100644
--- a/spec/lib/postzord/dispatch_spec.rb
+++ b/spec/lib/postzord/dispatch_spec.rb
@@ -23,10 +23,20 @@ describe Postzord::Dispatch do
zord.instance_variable_get(:@object).should == @sm
end
- it 'sets @subscribers from object' do
- @sm.should_receive(:subscribers).and_return(@subscribers)
- zord = Postzord::Dispatch.new(alice, @sm)
- zord.instance_variable_get(:@subscribers).should == @subscribers
+ context 'setting @subscribers' do
+ it 'sets @subscribers from object' do
+ @sm.should_receive(:subscribers).and_return(@subscribers)
+ zord = Postzord::Dispatch.new(alice, @sm)
+ zord.instance_variable_get(:@subscribers).should == @subscribers
+ end
+
+ it 'accepts additional subscribers from opts' do
+ new_person = Factory(:person)
+
+ @sm.should_receive(:subscribers).and_return(@subscribers)
+ zord = Postzord::Dispatch.new(alice, @sm, :additional_subscribers => new_person)
+ zord.instance_variable_get(:@subscribers).should == @subscribers | [new_person]
+ end
end
it 'sets the @sender_person object' do
diff --git a/spec/models/reshare_spec.rb b/spec/models/reshare_spec.rb
index 7fcd620ae..cd4a87bc5 100644
--- a/spec/models/reshare_spec.rb
+++ b/spec/models/reshare_spec.rb
@@ -17,4 +17,20 @@ describe Reshare do
it 'forces public' do
Factory(:reshare, :public => false).public.should be_true
end
+
+ describe "#receive" do
+ before do
+ @reshare = Factory.build(:reshare, :root => Factory.build(:status_message, :public => false))
+ @root = @reshare.root
+ @reshare.receive(@root.author.owner, @reshare.author)
+ end
+
+ it 'increments the reshare count' do
+ @root.resharers.count.should == 1
+ end
+
+ it 'adds the resharer to the re-sharers of the post' do
+ @root.resharers.should include(@reshare.author)
+ end
+ end
end