debian-mirror-gitlab/spec/controllers/profiles/accounts_controller_spec.rb

26 lines
718 B
Ruby
Raw Normal View History

2016-06-22 15:30:34 +05:30
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-08-24 12:49:21 +05:30
expect(response).to have_http_status(302)
2016-06-22 15:30:34 +05:30
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')
expect { delete :unlink, provider: 'twitter' }.to change(Identity.all, :size).by(-1)
end
end