From a068ee532d8bf00d11c6896fa8477560d7cfcf18 Mon Sep 17 00:00:00 2001 From: ilya Date: Tue, 12 Oct 2010 11:17:29 -0700 Subject: [PATCH] almost all green --- spec/models/person_spec.rb | 3 ++- spec/models/photo_spec.rb | 2 +- spec/models/user/visible_posts_spec.rb | 19 +++++++++---------- spec/user_encryption_spec.rb | 7 ++++--- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/spec/models/person_spec.rb b/spec/models/person_spec.rb index b8738f934..6e69721ae 100644 --- a/spec/models/person_spec.rb +++ b/spec/models/person_spec.rb @@ -43,6 +43,7 @@ describe Person do it 'should have a profile in its xml' do @xml.include?("first_name").should == true + end end @@ -54,7 +55,7 @@ describe Person do person_two.owns?(person_message).should be false end - it 'should delete all of user except comments upon user deletion' do + it 'should delete all of user posts except comments upon user deletion' do person = Factory.create(:person) Factory.create(:status_message, :person => person) diff --git a/spec/models/photo_spec.rb b/spec/models/photo_spec.rb index a239ec1c4..de70ce030 100644 --- a/spec/models/photo_spec.rb +++ b/spec/models/photo_spec.rb @@ -115,7 +115,7 @@ describe Photo do id = @photo.id @photo.destroy - @user.receive xml + @user.receive xml, @photo.person new_photo = Photo.first(:id => id) new_photo.url.nil?.should be false diff --git a/spec/models/user/visible_posts_spec.rb b/spec/models/user/visible_posts_spec.rb index c4cf40797..6f4345251 100644 --- a/spec/models/user/visible_posts_spec.rb +++ b/spec/models/user/visible_posts_spec.rb @@ -10,11 +10,15 @@ describe User do let!(:second_aspect) { user.aspect(:name => 'losers') } let!(:user2) { Factory(:user_with_aspect) } + let!(:user3) { Factory(:user_with_aspect) } + let!(:user4) { Factory(:user_with_aspect) } let!(:status_message1) { user2.post :status_message, :message => "hi", :to => user2.aspects.first.id } let!(:status_message2) { user2.post :status_message, :message => "hey", :public => true , :to => user2.aspects.first.id } let!(:status_message3) { user2.post :status_message, :message => "va", :to => user2.aspects.first.id } let!(:status_message4) { user2.post :status_message, :message => "da", :public => true , :to => user2.aspects.first.id } + let!(:status_message5) { user3.post :status_message, :message => "heyyyy", :to => user3.aspects.first.id} + let!(:status_message6) { user4.post :status_message, :message => "yooo", :to => user4.aspects.first.id} before do @@ -44,20 +48,15 @@ describe User do end it "queries by aspect" do - user3 = Factory(:user_with_aspect) - status_message2 = user3.post :status_message, :message => "heyyyy", :to => user3.aspects.first.id - user4 = Factory(:user_with_aspect) - status_message3 = user4.post :status_message, :message => "yooo", :to => user4.aspects.first.id - friend_users(user, second_aspect, user3, user3.aspects.first) friend_users(user, second_aspect, user4, user4.aspects.first) - user.receive status_message1.to_diaspora_xml - user.receive status_message2.to_diaspora_xml - user.receive status_message3.to_diaspora_xml + user.receive status_message4.to_diaspora_xml, user2.person + user.receive status_message5.to_diaspora_xml, user3.person + user.receive status_message6.to_diaspora_xml, user4.person - user.visible_posts(:by_members_of => first_aspect).should =~ [status_message1] - user.visible_posts(:by_members_of => second_aspect).should =~ [status_message2, status_message3] + user.visible_posts(:by_members_of => first_aspect).should =~ [status_message4] + user.visible_posts(:by_members_of => second_aspect).should =~ [status_message5, status_message6] end end diff --git a/spec/user_encryption_spec.rb b/spec/user_encryption_spec.rb index f222a7674..645563b9a 100644 --- a/spec/user_encryption_spec.rb +++ b/spec/user_encryption_spec.rb @@ -43,11 +43,12 @@ describe 'user encryption' do xml = request.to_diaspora_xml - remote_user.person.destroy - remote_user.destroy + remote_user.person.delete + remote_user.delete person_count = Person.all.count - proc {@user.receive xml}.should_not raise_error /ignature was not valid/ + @user.receive xml, remote_user.person + Person.all.count.should == person_count + 1 new_person = Person.first(:id => id) new_person.exported_key.should == original_key