Add failing test

This commit is contained in:
Marco Colli 2014-12-24 11:49:35 +01:00
parent 6c9f191696
commit f775d74cfd

View file

@ -8,7 +8,7 @@ describe ServicesController, :type => :controller do
let(:omniauth_auth) do let(:omniauth_auth) do
{ 'provider' => 'facebook', { 'provider' => 'facebook',
'uid' => '2', 'uid' => '2',
'info' => { 'nickname' => 'grimmin' }, 'info' => { 'nickname' => 'grimmin', 'image' => 'http://graph.facebook.com/2/picture' },
'credentials' => { 'token' => 'tokin', 'secret' =>"not_so_much" }} 'credentials' => { 'token' => 'tokin', 'secret' =>"not_so_much" }}
end end
let(:user) { alice } let(:user) { alice }
@ -46,6 +46,15 @@ describe ServicesController, :type => :controller do
expect(user.reload.services.first.class.name).to eq("Services::Facebook") expect(user.reload.services.first.class.name).to eq("Services::Facebook")
end 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 context 'when service exists with the same uid' do
before { Services::Twitter.create!(uid: omniauth_auth['uid'], user_id: user.id) } before { Services::Twitter.create!(uid: omniauth_auth['uid'], user_id: user.id) }