Skip to content
Extraits de code Groupes Projets
Valider 8b3c4f4c rédigé par Ilya Zhitomirskiy's avatar Ilya Zhitomirskiy
Parcourir les fichiers

checking on the attribute not the method

parent d51516ff
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -27,7 +27,7 @@ class ServicesController < ApplicationController
current_user.services << service
if service.persisted?
fetch_photo = current_user.person.profile.image_url.blank?
fetch_photo = current_user.person.profile[:image_url].blank?
current_user.update_profile(current_user.person.profile.from_omniauth_hash(user))
Resque.enqueue(Jobs::FetchProfilePhoto, current_user.id, service.id, user["image"]) if fetch_photo
......@@ -40,6 +40,7 @@ class ServicesController < ApplicationController
flash[:error] << I18n.t('services.create.already_authorized',
:diaspora_id => existing_service.user.person.profile.diaspora_handle,
:service_name => provider.camelize )
:A
end
end
......
......@@ -87,8 +87,10 @@ describe ServicesController do
request.env['omniauth.auth'] = omniauth_auth
end
it 'does not queue a job if the profile photo is not updated' do
@user.person.profile.stub(:image_url).and_return("/some/image_url.jpg")
it 'does not queue a job if the profile photo is set' do
profile = @user.person.profile
profile[:image_url] = "/non/default/image.jpg"
profile.save
Resque.should_not_receive(:enqueue)
......@@ -96,7 +98,9 @@ describe ServicesController do
end
it 'queues a job to save user photo if the photo does not exist' do
@user.person.profile.stub(:image_url).and_return(nil)
profile = @user.person.profile
profile[:image_url] = nil
profile.save
Resque.should_receive(:enqueue).with(Jobs::FetchProfilePhoto, @user.id, anything(), "https://service.com/fallback_lowres.jpg")
......
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