From 19199dabfe2a21a5f4e8a6a02624febd02d74d8c Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 24 Sep 2010 11:49:30 -0700 Subject: [PATCH] fix spec_helper for 1.9.2 --- spec/lib/diaspora_parser_spec.rb | 3 ++- spec/misc_spec.rb | 21 +++++++++++++++++++++ spec/models/aspect_spec.rb | 10 +++++----- spec/spec_helper.rb | 5 +++++ 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/spec/lib/diaspora_parser_spec.rb b/spec/lib/diaspora_parser_spec.rb index cdd1063ab..3f4e20b1e 100644 --- a/spec/lib/diaspora_parser_spec.rb +++ b/spec/lib/diaspora_parser_spec.rb @@ -103,7 +103,7 @@ describe Diaspora::Parser do it "should activate the Person if I initiated a request to that url" do request = @user.send_friend_request_to( @user2.person, @aspect) - + @user.reload request.reverse_for @user2 xml = request.to_diaspora_xml @@ -125,6 +125,7 @@ describe Diaspora::Parser do it 'should process retraction for a person' do person_count = Person.all.count request = @user.send_friend_request_to( @user2.person, @aspect) + @user.reload request.reverse_for @user2 xml = request.to_diaspora_xml diff --git a/spec/misc_spec.rb b/spec/misc_spec.rb index 14f1d4c3e..d03300211 100644 --- a/spec/misc_spec.rb +++ b/spec/misc_spec.rb @@ -34,4 +34,25 @@ describe 'making sure the spec runner works' do end end + describe '#friend_users' do + before do + @user1 = Factory.create(:user) + @aspect1 = @user1.aspect(:name => "losers") + @user2 = Factory.create(:user) + @aspect2 = @user2.aspect(:name => "bruisers") + friend_users(@user1, @aspect1, @user2, @aspect2) + @user1.reload + @aspect1.reload + @user2.reload + @aspect2.reload + end + + it 'makes the first user friends with the second' do + @aspect1.people.include?(@user2.person).should be_true + end + + it 'makes the second user friends with the first' do + @aspect2.people.include?(@user1.person).should be_true + end + end end diff --git a/spec/models/aspect_spec.rb b/spec/models/aspect_spec.rb index 5931970cf..ea5afc7cf 100644 --- a/spec/models/aspect_spec.rb +++ b/spec/models/aspect_spec.rb @@ -20,7 +20,7 @@ describe Aspect do aspect.name.should == "losers" end - it 'should be able to have people' do + it 'should be creatable with people' do aspect = @user.aspect(:name => 'losers', :people => [@friend, @friend_2]) aspect.people.size.should == 2 end @@ -156,16 +156,16 @@ describe Aspect do @user.receive message.to_diaspora_xml @aspect.reload - @aspect.posts.count.should be 1 - @aspect3.posts.count.should be 0 + @aspect.posts.count.should == 1 + @aspect3.posts.count.should == 0 @user.reload @user.move_friend(:friend_id => @user2.person.id, :from => @aspect.id, :to => @aspect3.id) @aspect.reload @aspect3.reload - @aspect3.posts.count.should be 1 - @aspect.posts.count.should be 0 + @aspect3.posts.count.should == 1 + @aspect.posts.count.should == 0 end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3fdac9810..ef5db93c2 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -82,7 +82,12 @@ end def friend_users(user1, aspect1, user2, aspect2) request = user1.send_friend_request_to(user2.person, aspect1) reversed_request = user2.accept_friend_request( request.id, aspect2.id) + user1.reload user1.receive reversed_request.to_diaspora_xml + user1.reload + aspect1.reload + user2.reload + aspect2.reload end def stub_success(address = 'abc@example.com')