summaryrefslogtreecommitdiff
path: root/spec/requests/api/users_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/requests/api/users_spec.rb')
-rw-r--r--spec/requests/api/users_spec.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb
index 18000d91795..a34c277112b 100644
--- a/spec/requests/api/users_spec.rb
+++ b/spec/requests/api/users_spec.rb
@@ -374,6 +374,7 @@ describe API::Users do
expect(response).to have_http_status(200)
expect(user.reload.password_expires_at).to be <= Time.now
+ expect(AuditEvent.count).to eq(1)
end
it "updates user with organization" do
@@ -401,6 +402,13 @@ describe API::Users do
expect(user.reload.email).to eq(user.email)
end
+ it 'updates user with a new email' do
+ put api("/users/#{user.id}", admin), email: 'new@email.com'
+ expect(response).to have_http_status(200)
+ expect(user.reload.notification_email).to eq('new@email.com')
+ expect(AuditEvent.count).to eq(1)
+ end
+
it 'updates user with his own username' do
put api("/users/#{user.id}", admin), username: user.username
expect(response).to have_http_status(200)
@@ -643,7 +651,7 @@ describe API::Users do
email_attrs = attributes_for :email
expect do
post api("/users/#{user.id}/emails", admin), email_attrs
- end.to change { user.emails.count }.by(1)
+ end.to change { user.emails.count }.by(1).and change { AuditEvent.count }.by(1)
end
it "returns a 400 for invalid ID" do