diff options
author | danielgrippi <danielgrippi@gmail.com> | 2011-07-14 00:37:36 +0400 |
---|---|---|
committer | Raphael Sofaer <raphael@joindiaspora.com> | 2011-07-22 05:22:17 +0400 |
commit | 7b3180e5da4a6dab67e543f237b3a9b6de1bc72f (patch) | |
tree | a4c6dc7dec60b73709e58bd47cf5540424a815c5 /spec | |
parent | f3a515eef165095b79de85418e33eb968e65e59a (diff) |
user can retract a reshared post
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/reshare_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/user_spec.rb | 45 |
2 files changed, 46 insertions, 1 deletions
diff --git a/spec/models/reshare_spec.rb b/spec/models/reshare_spec.rb index cd4a87bc5..523f6cc78 100644 --- a/spec/models/reshare_spec.rb +++ b/spec/models/reshare_spec.rb @@ -20,7 +20,7 @@ describe Reshare do describe "#receive" do before do - @reshare = Factory.build(:reshare, :root => Factory.build(:status_message, :public => false)) + @reshare = Factory.create(:reshare, :root => Factory(:status_message, :author => bob.person, :public => true)) @root = @reshare.root @reshare.receive(@root.author.owner, @reshare.author) end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index b34d92e3d..7cc3944c4 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -752,4 +752,49 @@ describe User do end end end + + describe '#retract' do + before do + @retraction = mock + end + + context "regular retractions" do + before do + Retraction.stub(:for).and_return(@retraction) + @retraction.stub(:perform) + + @post = Factory(:status_message, :author => bob.person, :public => true) + end + + it 'sends a retraction' do + dispatcher = mock + Postzord::Dispatch.should_receive(:new).with(bob, @retraction, anything()).and_return(dispatcher) + dispatcher.should_receive(:post) + + bob.retract(@post) + end + + it 'adds resharers of target post as additional subsctibers' do + person = Factory(:person) + reshare = Factory(:reshare, :root => @post, :author => person) + @post.reshares << reshare + + dispatcher = mock + Postzord::Dispatch.should_receive(:new).with(bob, @retraction, {:additional_subscribers => [person]}).and_return(dispatcher) + dispatcher.should_receive(:post) + + bob.retract(@post) + end + + it 'performs the retraction' do + + end + end + + context "relayable retractions" do + it 'sends a relayable retraction if the object is relayable' do + + end + end + end end |