diff options
author | Raphael Sofaer <raphael@joindiaspora.com> | 2011-07-23 00:12:12 +0400 |
---|---|---|
committer | Raphael Sofaer <raphael@joindiaspora.com> | 2011-07-23 00:12:12 +0400 |
commit | ad5dba052ca7c2d67e9e7c64ff8d46f84b2ab791 (patch) | |
tree | 9e38bf9241f39259a83fe283a37fef33640ae7e5 /spec | |
parent | 17774d8b3b94ab0f3c6917c65d30552959fa387e (diff) |
First reshare retraction spec is green
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/signed_retraction_spec.rb | 23 | ||||
-rw-r--r-- | spec/models/user_spec.rb | 22 | ||||
-rw-r--r-- | spec/multi_server/server_spec.rb | 10 |
3 files changed, 28 insertions, 27 deletions
diff --git a/spec/models/signed_retraction_spec.rb b/spec/models/signed_retraction_spec.rb new file mode 100644 index 000000000..de5b38da3 --- /dev/null +++ b/spec/models/signed_retraction_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe SignedRetraction do + before do + @post = Factory(:status_message, :author => bob.person, :public => true) + @resharer = Factory(:user) + @post.reshares << Factory.create(:reshare,:root_id => @post.id, :author => @resharer.person) + @post.save! + end + describe '#perform' do + it "dispatches the retraction onward to recipients of the recipient's reshare" do + retraction = SignedRetraction.build(bob, @post) + onward_retraction = retraction.dup + retraction.should_receive(:dup).and_return(onward_retraction) + + dis = mock + Postzord::Dispatch.should_receive(:new).with(@resharer, onward_retraction).and_return(dis) + dis.should_receive(:post) + + retraction.perform(@resharer) + end + end +end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index b71da5ee6..a3abdba86 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -790,27 +790,5 @@ describe User do pending end end - - context "signed retractions" do - before do - @post.reshares << Factory.create(:reshare,:root_id => @post.id, :author => Factory(:user).person) - @post.save! - end - - it 'relays the signed retraction onwards to recipients of reshares' do - r_ret = SignedRetraction.build(bob, @post) - SignedRetraction.should_receive(:build).and_return(r_ret) - - dis = mock - dis_2 = mock - dis.should_receive(:post).and_return{ r_ret.perform(@post.reshares.first.author.owner)} - #dis_2.should_receive(:post) - Postzord::Dispatch.should_receive(:new).with(bob, r_ret, anything()).and_return(dis, dis_2) - - fantasy_resque do - bob.retract(@post) - end - end - end end end diff --git a/spec/multi_server/server_spec.rb b/spec/multi_server/server_spec.rb index e8e01fea3..35f046af3 100644 --- a/spec/multi_server/server_spec.rb +++ b/spec/multi_server/server_spec.rb @@ -5,14 +5,14 @@ unless Server.all.empty? describe Server do before(:all) do WebMock::Config.instance.allow_localhost = true - Server.all.each{|s| s.kill if s.running?} - Server.all.each{|s| s.run} + #Server.all.each{|s| s.kill if s.running?} + #Server.all.each{|s| s.run} end after(:all) do - Server.all.each{|s| s.kill if s.running?} - sleep(1) - Server.all.each{|s| puts "Server at port #{s.port} still running." if s.running?} + #Server.all.each{|s| s.kill if s.running?} + #sleep(1) + #Server.all.each{|s| puts "Server at port #{s.port} still running." if s.running?} WebMock::Config.instance.allow_localhost = false end |