summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/features/profiles/password_spec.rb2
-rw-r--r--spec/models/user_spec.rb12
2 files changed, 13 insertions, 1 deletions
diff --git a/spec/features/profiles/password_spec.rb b/spec/features/profiles/password_spec.rb
index 4cbdd89d46f..a5ddb2b5ad0 100644
--- a/spec/features/profiles/password_spec.rb
+++ b/spec/features/profiles/password_spec.rb
@@ -25,7 +25,7 @@ describe 'Profile > Password', feature: true do
end
end
- it 'does not contains the current password field after an error' do
+ it 'does not contain the current password field after an error' do
fill_passwords('mypassword', 'mypassword2')
expect(page).to have_no_field('user[current_password]')
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index d5bd9946ab6..afebe611c88 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1857,4 +1857,16 @@ describe User, models: true do
user.invalidate_merge_request_cache_counts
end
end
+
+ describe 'audit changes' do
+ let!(:user) { create(:user) }
+
+ it 'audits an email change' do
+ expect { user.update!(email: 'test@example.com') }.to change { AuditEvent.count }.by(1)
+ end
+
+ it 'audits a password change' do
+ expect { user.update!(password: 'asdfasdf', password_confirmation: 'asdfasdf') }.to change { AuditEvent.count }.by(1)
+ end
+ end
end