Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/services_controller.rb3
-rw-r--r--spec/controllers/services_controller_spec.rb10
2 files changed, 9 insertions, 4 deletions
diff --git a/app/controllers/services_controller.rb b/app/controllers/services_controller.rb
index 8de2ee04b..1d4ad964c 100644
--- a/app/controllers/services_controller.rb
+++ b/app/controllers/services_controller.rb
@@ -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
diff --git a/spec/controllers/services_controller_spec.rb b/spec/controllers/services_controller_spec.rb
index 7f81b0410..b60321f1a 100644
--- a/spec/controllers/services_controller_spec.rb
+++ b/spec/controllers/services_controller_spec.rb
@@ -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")