diff options
author | Alexis Reigel <mail@koffeinfrei.org> | 2017-02-28 17:25:12 +0300 |
---|---|---|
committer | Alexis Reigel <mail@koffeinfrei.org> | 2017-07-27 16:42:04 +0300 |
commit | 8bd94a7304d392ad030295b5dfcd84c0100eddd1 (patch) | |
tree | 0e08bcdb460ad21c25646f686a42f4b743bf0129 /spec/models/user_spec.rb | |
parent | c1281982bd7975b45bed5b8e2c5ef5e242ea18fd (diff) |
remove gpg from keychain when user's email changes
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r-- | spec/models/user_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 20bdb7e37da..60979fd6c06 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1956,4 +1956,24 @@ describe User, models: true do expect(user.allow_password_authentication?).to be_falsey end end + + context 'callbacks' do + context '.synchronize_gpg_keys' do + let(:user) do + create(:user, email: 'tula.torphy@abshire.ca').tap do |user| + user.skip_reconfirmation! + end + end + + it 'does nothing when the name is updated' do + expect(user).not_to receive(:synchronize_gpg_keys) + user.update_attributes!(name: 'Bette') + end + + it 'synchronizes the gpg keys when the email is updated' do + expect(user).to receive(:synchronize_gpg_keys) + user.update_attributes!(email: 'shawnee.ritchie@denesik.com') + end + end + end end |