Skip to content
Extraits de code Groupes Projets
Valider 19199dab rédigé par Raphael's avatar Raphael
Parcourir les fichiers

fix spec_helper for 1.9.2

parent 40120bb4
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -103,7 +103,7 @@ describe Diaspora::Parser do ...@@ -103,7 +103,7 @@ describe Diaspora::Parser do
it "should activate the Person if I initiated a request to that url" do it "should activate the Person if I initiated a request to that url" do
request = @user.send_friend_request_to( @user2.person, @aspect) request = @user.send_friend_request_to( @user2.person, @aspect)
@user.reload
request.reverse_for @user2 request.reverse_for @user2
xml = request.to_diaspora_xml xml = request.to_diaspora_xml
...@@ -125,6 +125,7 @@ describe Diaspora::Parser do ...@@ -125,6 +125,7 @@ describe Diaspora::Parser do
it 'should process retraction for a person' do it 'should process retraction for a person' do
person_count = Person.all.count person_count = Person.all.count
request = @user.send_friend_request_to( @user2.person, @aspect) request = @user.send_friend_request_to( @user2.person, @aspect)
@user.reload
request.reverse_for @user2 request.reverse_for @user2
xml = request.to_diaspora_xml xml = request.to_diaspora_xml
......
...@@ -34,4 +34,25 @@ describe 'making sure the spec runner works' do ...@@ -34,4 +34,25 @@ describe 'making sure the spec runner works' do
end end
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 end
...@@ -20,7 +20,7 @@ describe Aspect do ...@@ -20,7 +20,7 @@ describe Aspect do
aspect.name.should == "losers" aspect.name.should == "losers"
end 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 = @user.aspect(:name => 'losers', :people => [@friend, @friend_2])
aspect.people.size.should == 2 aspect.people.size.should == 2
end end
...@@ -156,16 +156,16 @@ describe Aspect do ...@@ -156,16 +156,16 @@ describe Aspect do
@user.receive message.to_diaspora_xml @user.receive message.to_diaspora_xml
@aspect.reload @aspect.reload
@aspect.posts.count.should be 1 @aspect.posts.count.should == 1
@aspect3.posts.count.should be 0 @aspect3.posts.count.should == 0
@user.reload @user.reload
@user.move_friend(:friend_id => @user2.person.id, :from => @aspect.id, :to => @aspect3.id) @user.move_friend(:friend_id => @user2.person.id, :from => @aspect.id, :to => @aspect3.id)
@aspect.reload @aspect.reload
@aspect3.reload @aspect3.reload
@aspect3.posts.count.should be 1 @aspect3.posts.count.should == 1
@aspect.posts.count.should be 0 @aspect.posts.count.should == 0
end end
......
...@@ -82,7 +82,12 @@ end ...@@ -82,7 +82,12 @@ end
def friend_users(user1, aspect1, user2, aspect2) def friend_users(user1, aspect1, user2, aspect2)
request = user1.send_friend_request_to(user2.person, aspect1) request = user1.send_friend_request_to(user2.person, aspect1)
reversed_request = user2.accept_friend_request( request.id, aspect2.id) reversed_request = user2.accept_friend_request( request.id, aspect2.id)
user1.reload
user1.receive reversed_request.to_diaspora_xml user1.receive reversed_request.to_diaspora_xml
user1.reload
aspect1.reload
user2.reload
aspect2.reload
end end
def stub_success(address = 'abc@example.com') def stub_success(address = 'abc@example.com')
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter