Skip to content
Extraits de code Groupes Projets
Valider 32f08ef3 rédigé par zhitomirskiyi's avatar zhitomirskiyi
Parcourir les fichiers

fixed the nil photo_url and the all being called twice in the specs

parent 821703f4
Branches
Étiquettes
Aucune requête de fusion associée trouvée
...@@ -87,9 +87,9 @@ describe ServicesController do ...@@ -87,9 +87,9 @@ describe ServicesController do
@user.services << @service1 @user.services << @service1
@person = Factory(:person) @person = Factory(:person)
@user.services.stub!(:where).and_return([@service1]) @user.services.stub!(:where).and_return([@service1])
@hash = [ ServiceUser.create(:contact => @user.contact_for(bob.person), :name => "Robert Bobson", :person => bob.person, @hash = [ ServiceUser.create(:contact => @user.contact_for(bob.person), :name => "Robert Bobson", :photo_url => "cdn1.fb.com/pic1.jpg", :person => bob.person,
:service => @service1, :uid => "321" ), :service => @service1, :uid => "321" ),
ServiceUser.create(:name => "Robert Bobson", :service => @service1, :uid => "dsfasdfas")] ServiceUser.create(:name => "Robert Bobson", :photo_url => "cdn1.fb.com/pic1.jpg", :service => @service1, :uid => "dsfasdfas")]
@service1.should_receive(:finder).and_return(@hash) @service1.should_receive(:finder).and_return(@hash)
end end
......
...@@ -58,8 +58,7 @@ JSON ...@@ -58,8 +58,7 @@ JSON
describe '#save_friends' do describe '#save_friends' do
it 'requests a friend list' do it 'requests a friend list' do
RestClient.should_receive(:get).with("https://graph.facebook.com/me/friends", {:params => RestClient.should_receive(:get).with("https://graph.facebook.com/me/friends?fields[]=name&fields[]=picture&access_token=yeah").and_return(@web_mock)
{:fields => ['name', 'id', 'picture'], :access_token => @service.access_token}}).and_return(@web_mock)
@service.save_friends @service.save_friends
end end
...@@ -84,21 +83,21 @@ JSON ...@@ -84,21 +83,21 @@ JSON
context 'opts' do context 'opts' do
it 'only local does not return people who are remote' do it 'only local does not return people who are remote' do
@service.save_friends @service.save_friends
@service.finder(:local => true).all.each{|su| su.person.should == @user2.person} @service.finder(:local => true).each{|su| su.person.should == @user2.person}
end end
it 'does not return people who are remote' do it 'does not return people who are remote' do
@service.save_friends @service.save_friends
@service.finder(:remote => true).all.each{|su| su.person.should be_nil} @service.finder(:remote => true).each{|su| su.person.should be_nil}
end end
it 'does not return wrong service objects' do it 'does not return wrong service objects' do
su2 = ServiceUser.create(:service => @user2_service, :uid => @user2_fb_id, :name => @user2_fb_name, :photo_url => @user2_fb_photo_url) su2 = ServiceUser.create(:service => @user2_service, :uid => @user2_fb_id, :name => @user2_fb_name, :photo_url => @user2_fb_photo_url)
su2.person.should == @user2.person su2.person.should == @user2.person
@service.finder(:local => true).all.each{|su| su.service.should == @service} @service.finder(:local => true).each{|su| su.service.should == @service}
@service.finder(:remote => true).all.each{|su| su.service.should == @service} @service.finder(:remote => true).each{|su| su.service.should == @service}
@service.finder.all.each{|su| su.service.should == @service} @service.finder.each{|su| su.service.should == @service}
end end
end end
end end
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter