diff options
author | Robin Bobbitt <ryehle@us.ibm.com> | 2017-06-06 18:39:54 +0300 |
---|---|---|
committer | Robin Bobbitt <ryehle@us.ibm.com> | 2017-06-07 18:13:57 +0300 |
commit | 469acd190e497cda8516da0ee481f33e038d7e9e (patch) | |
tree | 7b2fd577757c49570fc353a02a23533a0674d8fa /spec/controllers/profiles_controller_spec.rb | |
parent | 8fdba5fac2a5fb4ce17a11580e94a85257e76e2c (diff) |
Sync email address from specified omniauth provider
Diffstat (limited to 'spec/controllers/profiles_controller_spec.rb')
-rw-r--r-- | spec/controllers/profiles_controller_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/controllers/profiles_controller_spec.rb b/spec/controllers/profiles_controller_spec.rb new file mode 100644 index 00000000000..9d60dab12d1 --- /dev/null +++ b/spec/controllers/profiles_controller_spec.rb @@ -0,0 +1,31 @@ +require('spec_helper') + +describe ProfilesController do + describe "PUT update" do + it "allows an email update from a user without an external email address" do + user = create(:user) + sign_in(user) + + put :update, + user: { email: "john@gmail.com", name: "John" } + + user.reload + + expect(response.status).to eq(302) + expect(user.unconfirmed_email).to eq('john@gmail.com') + end + + it "ignores an email update from a user with an external email address" do + ldap_user = create(:omniauth_user, external_email: true) + sign_in(ldap_user) + + put :update, + user: { email: "john@gmail.com", name: "John" } + + ldap_user.reload + + expect(response.status).to eq(302) + expect(ldap_user.unconfirmed_email).not_to eq('john@gmail.com') + end + end +end |