more stubbing! yay?

This commit is contained in:
Sarah Mei 2010-10-22 06:38:46 -07:00
parent 7e4529f2bd
commit ffa467b795
2 changed files with 43 additions and 29 deletions

View file

@ -56,6 +56,10 @@ describe Request do
end
it 'recognized when a request is not from me' do
deliverable = Object.new
deliverable.stub!(:deliver)
Notifier.stub!(:new_request).and_return(deliverable)
user2.receive_salmon(user.salmon(request).xml_for(user2.person))
user2.reload
user2.request_from_me?(request).should == false
@ -64,6 +68,10 @@ describe Request do
context 'quering request through user' do
it 'finds requests for that user' do
deliverable = Object.new
deliverable.stub!(:deliver)
Notifier.stub!(:new_request).and_return(deliverable)
user2.receive_salmon(user.salmon(request).xml_for(user2.person))
user2.reload
user2.requests_for_me.include?(request).should == true

View file

@ -1,3 +1,4 @@
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
@ -16,6 +17,12 @@ describe User do
let(:user2) { Factory.create :user }
let(:aspect2) { user2.aspect(:name => "aspect two") }
before do
deliverable = Object.new
deliverable.stub!(:deliver)
Notifier.stub!(:new_request).and_return(deliverable)
end
context 'friend requesting' do
it "should assign a request to a aspect" do
aspect.requests.size.should == 0
@ -101,7 +108,6 @@ describe User do
user.receive @req_xml, person_one
end
it 'should send a an email saying your friend request was confirmed' do
pending
end
@ -109,9 +115,9 @@ describe User do
context 'Two users receiving requests from one person' do
before do
user.receive @req_xml, person_one
user2.receive @req_two_xml, person_one
end
it 'should both users should befriend the same person' do
user.accept_friend_request @request.id, aspect.id
user.friends.include?(person_one).should be true