2016-06-14 19:28:17 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Profiles::AccountsController do
|
|
|
|
let(:user) { create(:omniauth_user, provider: 'saml') }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not allow to unlink SAML connected account' do
|
|
|
|
identity = user.identities.last
|
|
|
|
delete :unlink, provider: 'saml'
|
|
|
|
updated_user = User.find(user.id)
|
|
|
|
|
2016-06-27 14:10:42 -04:00
|
|
|
expect(response).to have_http_status(302)
|
2016-06-14 19:28:17 -04:00
|
|
|
expect(updated_user.identities.size).to eq(1)
|
|
|
|
expect(updated_user.identities).to include(identity)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does allow to delete other linked accounts' do
|
|
|
|
user.identities.create(provider: 'twitter', extern_uid: 'twitter_123')
|
|
|
|
|
2016-06-14 19:37:22 -04:00
|
|
|
expect { delete :unlink, provider: 'twitter' }.to change(Identity.all, :size).by(-1)
|
2016-06-14 19:28:17 -04:00
|
|
|
end
|
2016-06-14 19:37:22 -04:00
|
|
|
end
|