diff --git a/spec/controllers/services_controller_spec.rb b/spec/controllers/services_controller_spec.rb index 1dd5396c6d4155c0a92a5cc80cdbe57b2a02cb78..d7bd50e92d5959cace3ef03d2afe9a4979b712d7 100644 --- a/spec/controllers/services_controller_spec.rb +++ b/spec/controllers/services_controller_spec.rb @@ -8,7 +8,7 @@ describe ServicesController, :type => :controller do let(:omniauth_auth) do { 'provider' => 'facebook', 'uid' => '2', - 'info' => { 'nickname' => 'grimmin' }, + 'info' => { 'nickname' => 'grimmin', 'image' => 'http://graph.facebook.com/2/picture' }, 'credentials' => { 'token' => 'tokin', 'secret' =>"not_so_much" }} end let(:user) { alice } @@ -46,6 +46,15 @@ describe ServicesController, :type => :controller do expect(user.reload.services.first.class.name).to eq("Services::Facebook") end + context "when the user hasn't got a profile photo on Diaspora" do + before { user.person.profile.update_attribute :image_url, nil } + + it "imports the profile photo from the service" do + expect(Workers::FetchProfilePhoto).to receive(:perform_async) + post :create, :provider => 'facebook' + end + end + context 'when service exists with the same uid' do before { Services::Twitter.create!(uid: omniauth_auth['uid'], user_id: user.id) }