fix fb finder, flesh out test

This commit is contained in:
Raphael 2011-01-28 17:13:20 -08:00
parent 8151f3b540
commit 07850c7cb2
2 changed files with 5 additions and 4 deletions

View file

@ -21,7 +21,7 @@
= search_field_tag :contact_search, "", :class => 'contact_list_search', :results => 5, :placeholder => t('shared.contact_list.all_contacts') = search_field_tag :contact_search, "", :class => 'contact_list_search', :results => 5, :placeholder => t('shared.contact_list.all_contacts')
%ul %ul
- for uid in @friends.keys - for uid in @friends.keys
= render :partial => 'remote_friend', :friend => @friends[uid], :uid => uid = render :partial => 'remote_friend', :locals => {:friend => @friends[uid], :uid => uid}
- else - else
%br %br
%br %br

View file

@ -85,17 +85,18 @@ describe ServicesController do
before do before do
@service1 = Services::Facebook.new @service1 = Services::Facebook.new
@user.services << @service1 @user.services << @service1
@person = Factory(:person)
end end
it 'calls the finder method for the service for that user' do it 'calls the finder method for the service for that user' do
@user.services.stub!(:where).and_return([@service1]) @user.services.stub!(:where).and_return([@service1])
@service1.should_receive(:finder).and_return({}) @service1.should_receive(:finder).and_return("facebook_id" => {:contact => @user.contact_for(bob.person), :name => "Robert Bobson", :person => bob.person})
get :finder, :provider => @service1.provider get :finder, :provider => @service1.provider
end end
end end
describe '#invite' do describe '#invite' do
before do before do
@uid = "abc" @uid = "abc"
@invite_params = {:provider => 'facebook', :uid => @uid, :aspect_id => @user.aspects.first.id} @invite_params = {:provider => 'facebook', :uid => @uid, :aspect_id => @user.aspects.first.id}
@ -111,7 +112,7 @@ describe ServicesController do
assigns[:message].should include(User.last.invitation_token) assigns[:message].should include(User.last.invitation_token)
end end
it 'redirects to a prefilled facebook message url' do it 'redirects to a prefilled facebook message url' do
put :inviter, @invite_params put :inviter, @invite_params
response.location.should match(/https:\/\/www\.facebook\.com\/\?compose=1&id=.*&subject=.*&message=.*&sk=messages/) response.location.should match(/https:\/\/www\.facebook\.com\/\?compose=1&id=.*&subject=.*&message=.*&sk=messages/)
end end