diff options
author | Patricio Cano <suprnova32@gmail.com> | 2016-06-15 02:28:17 +0300 |
---|---|---|
committer | Patricio Cano <suprnova32@gmail.com> | 2016-06-15 02:28:17 +0300 |
commit | 34bf165147787125a601ad30a4a71ba7f966f724 (patch) | |
tree | ed8603b70ec788c10fc01763088bbe5849c83e61 /spec/controllers | |
parent | 27f75cf4a870c01682b9d76c46b23b7a3e1e0339 (diff) |
Disable the unlink feature for SAML connected accounts (social login).
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/profiles/accounts_controller_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/controllers/profiles/accounts_controller_spec.rb b/spec/controllers/profiles/accounts_controller_spec.rb new file mode 100644 index 00000000000..8658030214a --- /dev/null +++ b/spec/controllers/profiles/accounts_controller_spec.rb @@ -0,0 +1,28 @@ +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) + + expect(response.status).to eq(302) + 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
\ No newline at end of file |